From 967640b88f308f8727b867805ec337bfe1d3b07a Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Tue, 16 Jul 2024 00:26:22 +0200 Subject: [PATCH] Add support for all Mintlayer inputs and outputs --- common/protob/messages-bitcoin.proto | 1 + common/protob/messages-mintlayer.proto | 253 +- .../modtrezorcrypto/modtrezorcrypto-bip32.h | 30 - .../modtrezormintlayer-utils.h | 440 +- core/embed/rust/rust_ui_common.h | 72 +- core/embed/rust/src/mintlayer/mod.rs | 825 +- core/mocks/generated/trezormintlayer.pyi | 115 + core/src/all_modules.py | 6 + core/src/apps/bitcoin/sign_tx/layout.py | 18 + core/src/apps/common/keychain.py | 3 +- core/src/apps/mintlayer/get_public_key.py | 11 +- core/src/apps/mintlayer/sign_tx/helpers.py | 55 +- core/src/apps/mintlayer/sign_tx/layout.py | 342 + core/src/apps/mintlayer/sign_tx/signer.py | 235 +- core/src/trezor/crypto/bech32.py | 7 + core/src/trezor/enums/AmountUnit.py | 1 + .../enums/MintlayerTokenTotalSupplyType.py | 7 + core/src/trezor/enums/MintlayerUtxoType.py | 6 + core/src/trezor/enums/__init__.py | 10 + core/src/trezor/messages.py | 458 +- python/src/trezorlib/messages.py | 544 +- python/src/trezorlib/mintlayer.py | 4 +- rust/trezor-client/src/client/mintlayer.rs | 130 + rust/trezor-client/src/client/mod.rs | 3 + rust/trezor-client/src/error.rs | 10 + .../src/protos/generated/messages_bitcoin.rs | 11 +- .../protos/generated/messages_mintlayer.rs | 6681 ++++++++++++++++- 27 files changed, 9763 insertions(+), 515 deletions(-) create mode 100644 core/mocks/generated/trezormintlayer.pyi create mode 100644 core/src/apps/mintlayer/sign_tx/layout.py create mode 100644 core/src/trezor/enums/MintlayerTokenTotalSupplyType.py create mode 100644 core/src/trezor/enums/MintlayerUtxoType.py create mode 100644 rust/trezor-client/src/client/mintlayer.rs diff --git a/common/protob/messages-bitcoin.proto b/common/protob/messages-bitcoin.proto index 2b3ff3035d..50ae0d6df6 100644 --- a/common/protob/messages-bitcoin.proto +++ b/common/protob/messages-bitcoin.proto @@ -51,6 +51,7 @@ enum AmountUnit { MILLIBITCOIN = 1; // mBTC MICROBITCOIN = 2; // uBTC SATOSHI = 3; // sat + ML = 4; // Mintlayer } /** diff --git a/common/protob/messages-mintlayer.proto b/common/protob/messages-mintlayer.proto index 1344c60617..d3d2702277 100644 --- a/common/protob/messages-mintlayer.proto +++ b/common/protob/messages-mintlayer.proto @@ -94,7 +94,7 @@ message MintlayerSignTx { message MintlayerTxRequest { optional MintlayerRequestType request_type = 1; // what should be filled in TxAck message? optional MintlayerTxRequestDetailsType details = 2; // request for tx details - optional MintlayerTxRequestSerializedType serialized = 3; // serialized data and request for next + repeated MintlayerTxRequestSerializedType serialized = 3; // serialized data and request for next /** * Type of information required by transaction signing process */ @@ -121,16 +121,135 @@ message MintlayerTxRequest { } } +/** Data type for transaction input to be signed. + * + * @embed + */ +message MintlayerTxInput { + optional MintlayerUtxoTxInput utxo = 1; // UTXO input + optional MintlayerAccountTxInput account = 2; // account spending input + optional MintlayerAccountCommandTxInput account_command = 3; // account command input +} + +/** +* Type of information required by transaction signing process +*/ +enum MintlayerUtxoType { + TRANSACTION = 0; + BLOCK = 1; +} + /** Data type for transaction input to be signed. * * @embed */ message MintlayerUtxoTxInput { repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node - required bytes prev_hash = 2; // hash of previous transaction output to spend by this input - required uint32 prev_index = 3; // index of previous output to spend - optional uint32 sequence = 4 [default=0xffffffff]; // sequence - required uint64 amount = 5; // amount of previous transaction output + required string address = 2; // destination address in Base58 encoding; script_type must be PAYTOADDRESS + required bytes prev_hash = 3; // hash of previous transaction output to spend by this input + required uint32 prev_index = 4; // index of previous output to spend + required MintlayerUtxoType type = 5; // index of previous output to spend + optional uint32 sequence = 6 [default=0xffffffff]; // sequence + required MintlayerOutputValue value = 7; // amount of previous transaction output +} + +/** Data type for transaction input to be signed. + * + * @embed + */ +message MintlayerAccountTxInput { + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node + required string address = 2; // destination address in Base58 encoding; script_type must be PAYTOADDRESS + optional uint32 sequence = 3 [default=0xffffffff]; // sequence + required MintlayerOutputValue value = 4; // amount of previous transaction output + required uint64 nonce = 5; // incrementing account nonce + required bytes delegation_id = 6; // the delegation id of the account +} + +/** Data type for transaction input to be signed. + * + * @embed + */ +message MintlayerAccountCommandTxInput { + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node + required string address = 2; // destination address in Base58 encoding; script_type must be PAYTOADDRESS + optional uint32 sequence = 3 [default=0xffffffff]; // sequence + required uint64 nonce = 4; // incrementing account nonce + optional MintlayerMintTokens mint = 5; // mint tokens + optional MintlayerUnmintTokens unmint = 6; // unmint tokens + optional MintlayerLockTokenSupply lock_token_supply = 7; // lock token supply + optional MintlayerFreezeToken freeze_token = 8; // freeze supply + optional MintlayerUnfreezeToken unfreeze_token = 9; // unfreeze supply + optional MintlayerChangeTokenAuhtority change_token_authority = 10; // change token authority +} + +/** Data type for output value coins or token + * @embed + */ +message MintlayerMintTokens { + required bytes token_id = 1; // token id + required bytes amount = 2; // amoun of tokens to mint +} + +/** Data type for output value coins or token + * @embed + */ +message MintlayerUnmintTokens { + required bytes token_id = 1; // token id +} + +/** Data type for output value coins or token + * @embed + */ +message MintlayerLockTokenSupply { + required bytes token_id = 1; // token id +} + +/** Data type for output value coins or token + * @embed + */ +message MintlayerFreezeToken { + required bytes token_id = 1; // token id + required bool is_token_unfreezabe = 2; // is unfreezeable after freezing it +} + +/** Data type for output value coins or token + * @embed + */ +message MintlayerUnfreezeToken { + required bytes token_id = 1; // token id +} + +/** Data type for output value coins or token + * @embed + */ +message MintlayerChangeTokenAuhtority { + required bytes token_id = 1; // token id + required string destination = 2; // destination for the new authority +} + +/** Data type for transaction output to be signed. + * @embed + */ +message MintlayerTxOutput { + optional MintlayerTransferTxOutput transfer = 1; // transfer output + optional MintlayerLockThenTransferTxOutput lock_then_transfer = 2; // lock then transfer output + optional MintlayerBurnTxOutput burn = 3; // burn output + optional MintlayerCreateStakePoolTxOutput create_stake_pool = 4; // create stake pool output + optional MintlayerProduceBlockFromStakeTxOutput produce_block_from_stake = 5; // create block from stake output + optional MintlayerCreateDelegationIdTxOutput create_delegation_id = 6; // create delegation Id output + optional MintlayerDelegateStakingTxOutput delegate_staking = 7; // delegate staking output + optional MintlayerIssueFungibleTokenTxOutput issue_fungible_token = 8; // issue fungible token output + optional MintlayerIssueNftTxOutput issue_nft = 9; // issue NFT output + optional MintlayerDataDepositTxOutput data_deposit = 10; // data deposit output +} + +/** Data type for output value coins or token + * @embed + */ +message MintlayerOutputValue { + required bytes amount = 1; // lock until block height + optional bytes token_id = 2; // optional token id } /** Data type for transaction output to be signed. @@ -139,7 +258,123 @@ message MintlayerUtxoTxInput { message MintlayerTransferTxOutput { optional string address = 1; // destination address in Base58 encoding; script_type must be PAYTOADDRESS repeated uint32 address_n = 2; // BIP-32 path to derive the destination (used for change addresses) - required uint64 amount = 3; // amount to spend in satoshis + required MintlayerOutputValue value = 3; // amount to spend in atoms for coin or token +} + +/** Data type for time lock of an output + * @embed + */ +message MintlayerOutputTimeLock { + optional uint64 until_height = 1; // lock until block height + optional uint64 until_time = 2; // lock until time + optional uint64 for_block_count = 3; // lock for number of blocks + optional uint64 for_seconds = 4; // lock for number of seconds +} + +/** Data type for transaction output to be signed. + * @embed + */ +message MintlayerLockThenTransferTxOutput { + optional string address = 1; // destination address in Base58 encoding; script_type must be PAYTOADDRESS + repeated uint32 address_n = 2; // BIP-32 path to derive the destination (used for change addresses) + required MintlayerOutputValue value = 3; // amount to spend in atoms + required MintlayerOutputTimeLock lock = 4; // output lock +} + +/** Data type for transaction output to be signed. + * @embed + */ +message MintlayerBurnTxOutput { + required MintlayerOutputValue value = 1; // amount to burn in atoms +} + +/** Data type for transaction output to be signed. + * @embed + */ +message MintlayerCreateStakePoolTxOutput { + required bytes pool_id = 1; // the pool id + required bytes pledge = 2; // the pledge amount + required string staker = 3; // the staker destination address + required string vrf_public_key = 4; // the VRF public key address + required string decommission_key = 5; // the decommission key + required uint32 margin_ratio_per_thousand = 6;// the margin ratio per thousand + required bytes cost_per_block = 7; // the cost per block +} + +/** Data type for transaction output to be signed. + * @embed + */ +message MintlayerProduceBlockFromStakeTxOutput { + required string destination = 1; // the staker destination address + required bytes pool_id = 2; // the pool id +} + +/** Data type for transaction output to be signed. + * @embed + */ +message MintlayerCreateDelegationIdTxOutput { + required string destination = 1; // the delegation owner destination address + required bytes pool_id = 2; // the pool id +} + +/** Data type for transaction output to be signed. + * @embed + */ +message MintlayerDelegateStakingTxOutput { + required bytes amount = 1; // the amount to stake + required bytes delegation_id = 2; // the delegation id +} + +/** +* Type of information required by transaction signing process +*/ +enum MintlayerTokenTotalSupplyType { + FIXED = 0; + LOCKABLE = 1; + UNLIMITED = 2; +} + +/** Data type for transaction output to be signed. + * @embed + */ +message MintlayerTokenTotalSupply { + required MintlayerTokenTotalSupplyType type = 1; // the amount to stake + optional bytes fixed_amount = 2; // the amount to stake +} + +/** Data type for transaction output to be signed. + * @embed + */ +message MintlayerIssueFungibleTokenTxOutput { + required bytes token_ticker = 1; // the token ticker + required uint32 number_of_decimals = 2; // the number of decimals for the token + required bytes metadata_uri = 3; // the metadata uri + required MintlayerTokenTotalSupply total_supply = 4; // the total supply limit + required string authority = 5; // the token authority destination address + required bool is_freezable = 6; // if the token freezable or not +} + +/** Data type for transaction output to be signed. + * @embed + */ +message MintlayerIssueNftTxOutput { + required bytes token_id = 1; // the token id + required string destination = 2; // the NFT authority destination address + optional string creator = 3; // the NFT creator destination address + required bytes name = 4; // the NFT name + required bytes description = 5; // the NFT description + required bytes ticker = 6; // the NFT ticker + optional bytes icon_uri = 7; // the NFT icon uri + optional bytes additional_metadata_uri = 8; // the NFT additional metadata uri + optional bytes media_uri = 9; // the NFT media uri + required bytes media_hash = 10; // the NFT media hash +} + +/** Data type for transaction output to be signed. + * @embed + */ +message MintlayerDataDepositTxOutput { + required bytes data = 1; // the data to be deposited } /** Data type for metadata about previous transaction which contains the UTXO being spent. @@ -168,7 +403,7 @@ message MintlayerPrevInput { * @embed */ message MintlayerPrevTransferOutput { - required uint64 amount = 1; // amount sent to this output + required MintlayerOutputValue value = 1; // amount sent to this output } /** @@ -183,7 +418,7 @@ message MintlayerTxAckUtxoInput { required MintlayerTxAckInputWrapper tx = 1; message MintlayerTxAckInputWrapper { - required MintlayerUtxoTxInput input = 2; + required MintlayerTxInput input = 2; } } @@ -200,6 +435,6 @@ message MintlayerTxAckOutput { required MintlayerTxAckOutputWrapper tx = 1; message MintlayerTxAckOutputWrapper { - required MintlayerTransferTxOutput output = 5; + required MintlayerTxOutput output = 5; } } diff --git a/core/embed/extmod/modtrezorcrypto/modtrezorcrypto-bip32.h b/core/embed/extmod/modtrezorcrypto/modtrezorcrypto-bip32.h index 50141d6cae..996789b6f1 100644 --- a/core/embed/extmod/modtrezorcrypto/modtrezorcrypto-bip32.h +++ b/core/embed/extmod/modtrezorcrypto/modtrezorcrypto-bip32.h @@ -24,7 +24,6 @@ #include "embed/rust/rust_ui_common.h" - #include "bip32.h" #include "bip39.h" #include "curves.h" @@ -545,40 +544,11 @@ STATIC mp_obj_t mod_trezorcrypto_bip32_from_seed(mp_obj_t seed, STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_trezorcrypto_bip32_from_seed_obj, mod_trezorcrypto_bip32_from_seed); -/// def mintlayer_from_seed(seed: bytes, curve_name: str) -> bytes: -/// """ -/// Construct a BIP0032 HD node from a BIP0039 seed value. -/// """ -STATIC mp_obj_t mod_trezorcrypto_bip32_mintlayer_from_seed(mp_obj_t seed, - mp_obj_t curve_name) { - vstr_t pkh = {0}; - // uint32_t x = mintlayer_screen_fatal_error_rust(NULL, NULL, NULL); - // ((uint8_t *)pkh.buf)[0] = (uint8_t)x; - // ((uint8_t *)pkh.buf)[1] = (uint8_t)(x+1); - - unsigned char hex[32] = {0}; - hex[0] = 1; - hex[1] = 2; - ByteArray arr = mintlayer_encode_utxo_input(hex, 32, 10); - vstr_init_len(&pkh, arr.len); - int i = 0; - for (; i < arr.len; i++) { - ((uint8_t *)pkh.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &pkh); -} -// TODO: add separate new file with mintlayer functions -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_trezorcrypto_bip32_mintlayer_from_seed_obj, - mod_trezorcrypto_bip32_mintlayer_from_seed); - STATIC const mp_rom_map_elem_t mod_trezorcrypto_bip32_globals_table[] = { {MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_bip32)}, {MP_ROM_QSTR(MP_QSTR_HDNode), MP_ROM_PTR(&mod_trezorcrypto_HDNode_type)}, {MP_ROM_QSTR(MP_QSTR_from_seed), MP_ROM_PTR(&mod_trezorcrypto_bip32_from_seed_obj)}, - {MP_ROM_QSTR(MP_QSTR_mintlayer_from_seed), - MP_ROM_PTR(&mod_trezorcrypto_bip32_mintlayer_from_seed_obj)}, }; STATIC MP_DEFINE_CONST_DICT(mod_trezorcrypto_bip32_globals, mod_trezorcrypto_bip32_globals_table); diff --git a/core/embed/extmod/modtrezormintlayer/modtrezormintlayer-utils.h b/core/embed/extmod/modtrezormintlayer/modtrezormintlayer-utils.h index c7ebe579ff..38487c2f08 100644 --- a/core/embed/extmod/modtrezormintlayer/modtrezormintlayer-utils.h +++ b/core/embed/extmod/modtrezormintlayer/modtrezormintlayer-utils.h @@ -11,12 +11,12 @@ #include "curves.h" #include "memzero.h" -/// def encode_utxo_input(tx_hash: bytes, index: int) -> bytes: +/// def encode_utxo_input(tx_hash: bytes, index: int, utxo_type: int) -> bytes: /// """ /// encodes an utxo input from tx_hash and index /// """ STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_utxo_input( - mp_obj_t tx_hash, mp_obj_t index) { + mp_obj_t tx_hash, mp_obj_t index, mp_obj_t utxo_type_obj) { mp_buffer_info_t hash = {0}; mp_get_buffer_raise(tx_hash, &hash, MP_BUFFER_READ); if (hash.len != 32) { @@ -24,7 +24,9 @@ STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_utxo_input( mp_raise_ValueError("Invalid hash"); } uint32_t idx = trezor_obj_get_uint(index); - ByteArray arr = mintlayer_encode_utxo_input(hash.buf, hash.len, idx); + uint32_t utxo_type = trezor_obj_get_uint(utxo_type_obj); + ByteArray arr = + mintlayer_encode_utxo_input(hash.buf, hash.len, idx, utxo_type); vstr_t pkh = {0}; vstr_init_len(&pkh, arr.len); @@ -36,22 +38,101 @@ STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_utxo_input( return mp_obj_new_str_from_vstr(&mp_type_bytes, &pkh); } -STATIC MP_DEFINE_CONST_FUN_OBJ_2( +STATIC MP_DEFINE_CONST_FUN_OBJ_3( mod_trezormintlayer_utils_mintlayer_encode_utxo_input_obj, mod_trezormintlayer_utils_mintlayer_encode_utxo_input); -/// def encode_transfer_output(amount: str, address: str) -> bytes: +/// def encode_account_spending_input(nonce: int, delegation_id: str, amount: +/// bytes) -> bytes: +/// """ +/// encodes an utxo input from tx_hash and index +/// """ +STATIC mp_obj_t +mod_trezormintlayer_utils_mintlayer_encode_account_spending_input( + mp_obj_t nonce_obj, mp_obj_t delegation_id, mp_obj_t amount_obj) { + uint64_t nonce = trezor_obj_get_uint64(nonce_obj); + + mp_buffer_info_t hash = {0}; + mp_get_buffer_raise(delegation_id, &hash, MP_BUFFER_READ); + if (hash.len != 32) { + printf("invalid hash len: %ld", (long int)hash.len); + mp_raise_ValueError("Invalid hash"); + } + + mp_buffer_info_t amount = {0}; + mp_get_buffer_raise(amount_obj, &amount, MP_BUFFER_READ); + + ByteArray arr = mintlayer_encode_account_spending_input( + nonce, hash.buf, hash.len, amount.buf, amount.len); + + vstr_t pkh = {0}; + vstr_init_len(&pkh, arr.len); + int i = 0; + for (; i < arr.len; i++) { + ((uint8_t *)pkh.buf)[i] = (uint8_t)arr.data[i]; + } + + return mp_obj_new_str_from_vstr(&mp_type_bytes, &pkh); +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_3( + mod_trezormintlayer_utils_mintlayer_encode_account_spending_input_obj, + mod_trezormintlayer_utils_mintlayer_encode_account_spending_input); + +/// def encode_account_command_input(nonce: int, command: int token_id: str, +/// data: bytes) -> bytes: +/// """ +/// encodes an utxo input from tx_hash and index +/// """ +STATIC mp_obj_t +mod_trezormintlayer_utils_mintlayer_encode_account_command_input( + size_t n_args, const mp_obj_t *args) { + uint64_t nonce = trezor_obj_get_uint64(args[0]); + uint32_t command = trezor_obj_get_uint(args[1]); + + mp_buffer_info_t hash = {0}; + mp_get_buffer_raise(args[2], &hash, MP_BUFFER_READ); + if (hash.len != 32) { + printf("invalid hash len: %ld", (long int)hash.len); + mp_raise_ValueError("Invalid hash"); + } + + mp_buffer_info_t data = {0}; + mp_get_buffer_raise(args[3], &data, MP_BUFFER_READ); + + ByteArray arr = mintlayer_encode_account_command_input( + nonce, command, hash.buf, hash.len, data.buf, data.len); + + vstr_t pkh = {0}; + vstr_init_len(&pkh, arr.len); + int i = 0; + for (; i < arr.len; i++) { + ((uint8_t *)pkh.buf)[i] = (uint8_t)arr.data[i]; + } + + return mp_obj_new_str_from_vstr(&mp_type_bytes, &pkh); +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( + mod_trezormintlayer_utils_mintlayer_encode_account_command_input_obj, 4, 4, + mod_trezormintlayer_utils_mintlayer_encode_account_command_input); + +/// def encode_transfer_output(amount: str, token_id: str, address: str) -> +/// bytes: /// """ /// encodes a transfer output with given amount and destination address /// """ STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_transfer_output( - mp_obj_t amount_obj, mp_obj_t address_obj) { + mp_obj_t amount_obj, mp_obj_t token_id_obj, mp_obj_t address_obj) { mp_buffer_info_t amount = {0}; mp_get_buffer_raise(amount_obj, &amount, MP_BUFFER_READ); + mp_buffer_info_t token_id = {0}; + mp_get_buffer_raise(token_id_obj, &token_id, MP_BUFFER_READ); mp_buffer_info_t address = {0}; mp_get_buffer_raise(address_obj, &address, MP_BUFFER_READ); - ByteArray arr = mintlayer_encode_transfer_output(amount.buf, amount.len, - address.buf, address.len); + ByteArray arr = + mintlayer_encode_transfer_output(amount.buf, amount.len, token_id.buf, + token_id.len, address.buf, address.len); vstr_t encoding = {0}; vstr_init_len(&encoding, arr.len); @@ -63,10 +144,320 @@ STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_transfer_output( return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); } -STATIC MP_DEFINE_CONST_FUN_OBJ_2( +STATIC MP_DEFINE_CONST_FUN_OBJ_3( mod_trezormintlayer_utils_mintlayer_encode_transfer_output_obj, mod_trezormintlayer_utils_mintlayer_encode_transfer_output); +/// def encode_lock_then_transfer_output(amount: str, token_id: str, lock_type: +/// int, lock_amount:int, address: str) -> bytes: +/// """ +/// encodes a transfer output with given amount and destination address +/// """ +STATIC mp_obj_t +mod_trezormintlayer_utils_mintlayer_encode_lock_then_transfer_output( + size_t n_args, const mp_obj_t *args) { + mp_buffer_info_t amount = {0}; + mp_get_buffer_raise(args[0], &amount, MP_BUFFER_READ); + mp_buffer_info_t token_id = {0}; + mp_get_buffer_raise(args[1], &token_id, MP_BUFFER_READ); + uint8_t lock_type = trezor_obj_get_uint8(args[2]); + uint64_t lock_amount = trezor_obj_get_uint64(args[3]); + mp_buffer_info_t address = {0}; + mp_get_buffer_raise(args[4], &address, MP_BUFFER_READ); + ByteArray arr = mintlayer_encode_lock_then_transfer_output( + amount.buf, amount.len, token_id.buf, token_id.len, lock_type, + lock_amount, address.buf, address.len); + + vstr_t encoding = {0}; + vstr_init_len(&encoding, arr.len); + int i = 0; + for (; i < arr.len; i++) { + ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; + } + + return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( + mod_trezormintlayer_utils_mintlayer_encode_lock_then_transfer_output_obj, 5, + 5, mod_trezormintlayer_utils_mintlayer_encode_lock_then_transfer_output); + +/// def encode_burn_output(amount: str, token_id: str) -> +/// bytes: +/// """ +/// encodes a transfer output with given amount and destination address +/// """ +STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_burn_output( + mp_obj_t amount_obj, mp_obj_t token_id_obj) { + mp_buffer_info_t amount = {0}; + mp_get_buffer_raise(amount_obj, &amount, MP_BUFFER_READ); + mp_buffer_info_t token_id = {0}; + mp_get_buffer_raise(token_id_obj, &token_id, MP_BUFFER_READ); + ByteArray arr = mintlayer_encode_burn_output(amount.buf, amount.len, + token_id.buf, token_id.len); + + vstr_t encoding = {0}; + vstr_init_len(&encoding, arr.len); + int i = 0; + for (; i < arr.len; i++) { + ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; + } + + return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_2( + mod_trezormintlayer_utils_mintlayer_encode_burn_output_obj, + mod_trezormintlayer_utils_mintlayer_encode_burn_output); + +/// def encode_create_stake_pool_output(pool_id: str, pledge_amount: str, +/// staker: str, vrf_public_key: str, decommission_key: str, +/// margin_ratio_per_thousand: int, cost_per_block: str) -> bytes: +/// """ +/// encodes a transfer output with given amount and destination address +/// """ +STATIC mp_obj_t +mod_trezormintlayer_utils_mintlayer_encode_create_stake_pool_output( + size_t n_args, const mp_obj_t *args) { + mp_buffer_info_t pool_id = {0}; + mp_get_buffer_raise(args[0], &pool_id, MP_BUFFER_READ); + mp_buffer_info_t pledge_amount = {0}; + mp_get_buffer_raise(args[1], &pledge_amount, MP_BUFFER_READ); + mp_buffer_info_t staker = {0}; + mp_get_buffer_raise(args[2], &staker, MP_BUFFER_READ); + mp_buffer_info_t vrf_public_key = {0}; + mp_get_buffer_raise(args[3], &vrf_public_key, MP_BUFFER_READ); + mp_buffer_info_t decommission_key = {0}; + mp_get_buffer_raise(args[4], &decommission_key, MP_BUFFER_READ); + uint16_t margin_ratio_per_thousand = (uint16_t)trezor_obj_get_uint64(args[5]); + mp_buffer_info_t cost_per_block = {0}; + mp_get_buffer_raise(args[6], &cost_per_block, MP_BUFFER_READ); + + ByteArray arr = mintlayer_encode_create_stake_pool_output( + pool_id.buf, pool_id.len, pledge_amount.buf, pledge_amount.len, + staker.buf, staker.len, vrf_public_key.buf, vrf_public_key.len, + decommission_key.buf, decommission_key.len, margin_ratio_per_thousand, + cost_per_block.buf, cost_per_block.len); + + vstr_t encoding = {0}; + vstr_init_len(&encoding, arr.len); + int i = 0; + for (; i < arr.len; i++) { + ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; + } + + return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( + mod_trezormintlayer_utils_mintlayer_encode_create_stake_pool_output_obj, 7, + 7, mod_trezormintlayer_utils_mintlayer_encode_create_stake_pool_output); + +/// def encode_produce_from_stake_output(destination: str, pool_id: str) -> +/// bytes: +/// """ +/// encodes a transfer output with given amount and destination address +/// """ +STATIC mp_obj_t +mod_trezormintlayer_utils_mintlayer_encode_produce_from_stake_output( + mp_obj_t destination_obj, mp_obj_t pool_id_obj) { + mp_buffer_info_t destination = {0}; + mp_get_buffer_raise(destination_obj, &destination, MP_BUFFER_READ); + mp_buffer_info_t pool_id = {0}; + mp_get_buffer_raise(pool_id_obj, &pool_id, MP_BUFFER_READ); + ByteArray arr = mintlayer_encode_produce_from_stake_output( + destination.buf, destination.len, pool_id.buf, pool_id.len); + + vstr_t encoding = {0}; + vstr_init_len(&encoding, arr.len); + int i = 0; + for (; i < arr.len; i++) { + ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; + } + + return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_2( + mod_trezormintlayer_utils_mintlayer_encode_produce_from_stake_output_obj, + mod_trezormintlayer_utils_mintlayer_encode_produce_from_stake_output); + +/// def encode_create_delegation_id_output(destination: str, pool_id: str) -> +/// bytes: +/// """ +/// encodes a transfer output with given amount and destination address +/// """ +STATIC mp_obj_t +mod_trezormintlayer_utils_mintlayer_encode_create_delegation_id_output( + mp_obj_t destination_obj, mp_obj_t pool_id_obj) { + mp_buffer_info_t destination = {0}; + mp_get_buffer_raise(destination_obj, &destination, MP_BUFFER_READ); + mp_buffer_info_t pool_id = {0}; + mp_get_buffer_raise(pool_id_obj, &pool_id, MP_BUFFER_READ); + ByteArray arr = mintlayer_encode_create_delegation_id_output( + destination.buf, destination.len, pool_id.buf, pool_id.len); + + vstr_t encoding = {0}; + vstr_init_len(&encoding, arr.len); + int i = 0; + for (; i < arr.len; i++) { + ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; + } + + return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_2( + mod_trezormintlayer_utils_mintlayer_encode_create_delegation_id_output_obj, + mod_trezormintlayer_utils_mintlayer_encode_create_delegation_id_output); + +/// def encode_delegate_staking_output(amount: str, delegation_id: str) -> +/// bytes: +/// """ +/// encodes a transfer output with given amount and destination address +/// """ +STATIC mp_obj_t +mod_trezormintlayer_utils_mintlayer_encode_delegate_staking_output( + mp_obj_t destination_obj, mp_obj_t delegation_id_obj) { + mp_buffer_info_t amount = {0}; + mp_get_buffer_raise(destination_obj, &amount, MP_BUFFER_READ); + mp_buffer_info_t delegation_id = {0}; + mp_get_buffer_raise(delegation_id_obj, &delegation_id, MP_BUFFER_READ); + ByteArray arr = mintlayer_encode_delegate_staking_output( + amount.buf, amount.len, delegation_id.buf, delegation_id.len); + + vstr_t encoding = {0}; + vstr_init_len(&encoding, arr.len); + int i = 0; + for (; i < arr.len; i++) { + ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; + } + + return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_2( + mod_trezormintlayer_utils_mintlayer_encode_delegate_staking_output_obj, + mod_trezormintlayer_utils_mintlayer_encode_delegate_staking_output); + +/// def encode_issue_fungible_token_output(token_ticker: str, +/// number_of_decimals: int, metadata_uri: str, total_supply_type: int, +/// fixed_amount: str, authority: str, is_freezable: int) -> bytes: +/// """ +/// encodes a transfer output with given amount and destination address +/// """ +STATIC mp_obj_t +mod_trezormintlayer_utils_mintlayer_encode_issue_fungible_token_output( + size_t n_args, const mp_obj_t *args) { + mp_buffer_info_t token_ticker = {0}; + mp_get_buffer_raise(args[0], &token_ticker, MP_BUFFER_READ); + uint8_t number_of_decimals = trezor_obj_get_uint8(args[1]); + mp_buffer_info_t metadata_uri = {0}; + mp_get_buffer_raise(args[2], &metadata_uri, MP_BUFFER_READ); + uint32_t total_supply_type = (uint32_t)trezor_obj_get_uint64(args[3]); + mp_buffer_info_t fixed_amount = {0}; + mp_get_buffer_raise(args[4], &fixed_amount, MP_BUFFER_READ); + mp_buffer_info_t authority = {0}; + mp_get_buffer_raise(args[5], &authority, MP_BUFFER_READ); + uint8_t is_freezable = trezor_obj_get_uint8(args[6]); + + ByteArray arr = mintlayer_encode_issue_fungible_token_output( + token_ticker.buf, token_ticker.len, number_of_decimals, metadata_uri.buf, + metadata_uri.len, total_supply_type, fixed_amount.buf, fixed_amount.len, + authority.buf, authority.len, is_freezable); + + vstr_t encoding = {0}; + vstr_init_len(&encoding, arr.len); + int i = 0; + for (; i < arr.len; i++) { + ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; + } + + return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( + mod_trezormintlayer_utils_mintlayer_encode_issue_fungible_token_output_obj, + 7, 7, + mod_trezormintlayer_utils_mintlayer_encode_issue_fungible_token_output); + +/// def encode_issue_nft_output(token_id: str, +/// creator: str, name: str, destination: str, +/// ticker: str, icon_uri: str, additional_metadata_uri: str, media_uri: str, +/// media_hash: str, destination: str) -> bytes: +/// """ +/// encodes a transfer output with given amount and destination address +/// """ +STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_issue_nft_output( + size_t n_args, const mp_obj_t *args) { + mp_buffer_info_t token_id = {0}; + mp_get_buffer_raise(args[0], &token_id, MP_BUFFER_READ); + mp_buffer_info_t creator = {0}; + mp_get_buffer_raise(args[1], &creator, MP_BUFFER_READ); + mp_buffer_info_t name = {0}; + mp_get_buffer_raise(args[2], &name, MP_BUFFER_READ); + mp_buffer_info_t description = {0}; + mp_get_buffer_raise(args[3], &description, MP_BUFFER_READ); + mp_buffer_info_t ticker = {0}; + mp_get_buffer_raise(args[4], &ticker, MP_BUFFER_READ); + mp_buffer_info_t icon_uri = {0}; + mp_get_buffer_raise(args[5], &icon_uri, MP_BUFFER_READ); + mp_buffer_info_t additional_metadata_uri = {0}; + mp_get_buffer_raise(args[6], &additional_metadata_uri, MP_BUFFER_READ); + mp_buffer_info_t media_uri = {0}; + mp_get_buffer_raise(args[7], &media_uri, MP_BUFFER_READ); + mp_buffer_info_t media_hash = {0}; + mp_get_buffer_raise(args[8], &media_hash, MP_BUFFER_READ); + mp_buffer_info_t destination = {0}; + mp_get_buffer_raise(args[9], &destination, MP_BUFFER_READ); + + ByteArray arr = mintlayer_encode_issue_nft_output( + token_id.buf, token_id.len, creator.buf, creator.len, name.buf, name.len, + description.buf, description.len, ticker.buf, ticker.len, icon_uri.buf, + icon_uri.len, additional_metadata_uri.buf, additional_metadata_uri.len, + media_uri.buf, media_uri.len, media_hash.buf, media_hash.len, + destination.buf, destination.len); + + vstr_t encoding = {0}; + vstr_init_len(&encoding, arr.len); + int i = 0; + for (; i < arr.len; i++) { + ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; + } + + return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( + mod_trezormintlayer_utils_mintlayer_encode_issue_nft_output_obj, 10, 10, + mod_trezormintlayer_utils_mintlayer_encode_issue_nft_output); + +/// def encode_data_deposit_output(deposit: str) -> +/// bytes: +/// """ +/// encodes a transfer output with given amount and destination address +/// """ +STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_data_deposit_output( + mp_obj_t deposit_obj) { + mp_buffer_info_t deposit = {0}; + mp_get_buffer_raise(deposit_obj, &deposit, MP_BUFFER_READ); + ByteArray arr = + mintlayer_encode_data_deposit_output(deposit.buf, deposit.len); + + vstr_t encoding = {0}; + vstr_init_len(&encoding, arr.len); + int i = 0; + for (; i < arr.len; i++) { + ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; + } + + return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_1( + mod_trezormintlayer_utils_mintlayer_encode_data_deposit_output_obj, + mod_trezormintlayer_utils_mintlayer_encode_data_deposit_output); + /// def encode_compact_length(length: int) -> bytes: /// """ /// encodes a comapct length to bytes @@ -94,9 +485,40 @@ STATIC const mp_rom_map_elem_t mod_trezormintlayer_utils_globals_table[] = { {MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_bip32)}, {MP_ROM_QSTR(MP_QSTR_encode_utxo_input), MP_ROM_PTR(&mod_trezormintlayer_utils_mintlayer_encode_utxo_input_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_account_spending_input), + MP_ROM_PTR(&mod_trezormintlayer_utils_mintlayer_encode_account_spending_input_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_account_command_input), + MP_ROM_PTR(&mod_trezormintlayer_utils_mintlayer_encode_account_command_input_obj)}, {MP_ROM_QSTR(MP_QSTR_encode_transfer_output), MP_ROM_PTR( &mod_trezormintlayer_utils_mintlayer_encode_transfer_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_lock_then_transfer_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_lock_then_transfer_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_burn_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_burn_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_create_stake_pool_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_create_stake_pool_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_produce_from_stake_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_produce_from_stake_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_create_delegation_id_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_create_delegation_id_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_delegate_staking_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_delegate_staking_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_issue_fungible_token_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_issue_fungible_token_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_issue_nft_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_issue_nft_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_data_deposit_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_data_deposit_output_obj)}, {MP_ROM_QSTR(MP_QSTR_encode_compact_length), MP_ROM_PTR(&mod_trezormintlayer_utils_mintlayer_encode_comact_length_obj)}, }; diff --git a/core/embed/rust/rust_ui_common.h b/core/embed/rust/rust_ui_common.h index a25580ffd9..cfbcdb1f9b 100644 --- a/core/embed/rust/rust_ui_common.h +++ b/core/embed/rust/rust_ui_common.h @@ -12,12 +12,82 @@ typedef struct { } ByteArray; ByteArray mintlayer_encode_utxo_input(const unsigned char* hex, - uint32_t hex_len, uint32_t index); + uint32_t hex_len, uint32_t index, + uint32_t utxo_type); + +ByteArray mintlayer_encode_account_spending_input( + uint64_t nonce, const unsigned char* delegation_id_data, + uint32_t delegation_id_data_len, const unsigned char* amount_data, + uint32_t amount_data_len); + +ByteArray mintlayer_encode_account_command_input( + uint64_t nonce, uint32_t command, const unsigned char* token_id_data, + uint32_t token_id_data_len, const unsigned char* data, uint32_t data_len); ByteArray mintlayer_encode_transfer_output( const unsigned char* coin_amount_data, uint32_t coin_amount_data_len, + const unsigned char* token_id_data, uint32_t token_id_data_len, const unsigned char* address_data, uint32_t address_data_len); +ByteArray mintlayer_encode_lock_then_transfer_output( + const unsigned char* coin_amount_data, uint32_t coin_amount_data_len, + const unsigned char* token_id_data, uint32_t token_id_data_len, + uint8_t lock_type, uint64_t lock_amount, const unsigned char* address_data, + uint32_t address_data_len); + +ByteArray mintlayer_encode_burn_output(const unsigned char* coin_amount_data, + uint32_t coin_amount_data_len, + const unsigned char* token_id_data, + uint32_t token_id_data_len); + +ByteArray mintlayer_encode_create_stake_pool_output( + const unsigned char* pool_id_data, uint32_t pool_id_data_len, + const unsigned char* pledge_amount_data, uint32_t pledge_amount_data_len, + const unsigned char* staker_destination_data, + uint32_t staker_destination_data_len, + const unsigned char* vrf_public_key_data, uint32_t vrf_public_key_data_len, + const unsigned char* decommission_destination_data, + uint32_t decommission_destination_data_len, + uint16_t margin_ratio_per_thousand, + const unsigned char* cost_per_block_amount_data, + uint32_t cost_per_block_amount_data_len); + +ByteArray mintlayer_encode_produce_from_stake_output( + const unsigned char* destination_data, uint32_t destination_data_len, + const unsigned char* pool_id_data, uint32_t pool_id_data_len); + +ByteArray mintlayer_encode_create_delegation_id_output( + const unsigned char* destination_data, uint32_t destination_data_len, + const unsigned char* pool_id_data, uint32_t pool_id_data_len); + +ByteArray mintlayer_encode_delegate_staking_output( + const unsigned char* amount_data, uint32_t amount_data_len, + const unsigned char* pool_id_data, uint32_t pool_id_data_len); + +ByteArray mintlayer_encode_issue_fungible_token_output( + const unsigned char* token_ticker_data, uint32_t token_ticker_data_len, + uint8_t number_of_decimals, const unsigned char* metadata_uri_data, + uint32_t metadata_uri_data_len, uint32_t total_supply_type, + const unsigned char* fixed_amount_data, uint32_t fixed_amount_data_len, + const unsigned char* authority_data, uint32_t authority_data_len, + uint8_t is_freezable); + +ByteArray mintlayer_encode_issue_nft_output( + const unsigned char* token_id_data, uint32_t token_id_data_len, + const unsigned char* creator_data, uint32_t creator_data_len, + const unsigned char* name_data, uint32_t name_data_len, + const unsigned char* description_data, uint32_t description_data_len, + const unsigned char* ticker_data, uint32_t ticker_data_len, + const unsigned char* icon_uri_data, uint32_t icon_uri_data_len, + const unsigned char* additional_metadata_uri_data, + uint32_t additional_metadata_uri_data_len, + const unsigned char* media_uri_data, uint32_t media_uri_data_len, + const unsigned char* media_hash_data, uint32_t media_hash_data_len, + const unsigned char* destination_data, uint32_t destination_data_len); + +ByteArray mintlayer_encode_data_deposit_output( + const unsigned char* deposit_data, uint32_t deposit_data_len); + ByteArray mintlayer_encode_compact_length(uint32_t length); void screen_boot_stage_2(void); diff --git a/core/embed/rust/src/mintlayer/mod.rs b/core/embed/rust/src/mintlayer/mod.rs index 5073e088ba..00d9b60028 100644 --- a/core/embed/rust/src/mintlayer/mod.rs +++ b/core/embed/rust/src/mintlayer/mod.rs @@ -3,22 +3,13 @@ use core::{ alloc::{GlobalAlloc, Layout}, num::ParseIntError, ptr::null_mut, - str::{from_utf8, FromStr}, + str::FromStr, }; use parity_scale_codec::{Decode, DecodeAll, Encode}; const TEN: UnsignedIntType = 10; -#[no_mangle] -extern "C" fn mintlayer_screen_fatal_error_rust( - title: *const cty::c_char, - msg: *const cty::c_char, - footer: *const cty::c_char, -) -> u32 { - 42 -} - #[repr(C)] pub struct ByteArray { data: *const cty::c_uchar, @@ -26,12 +17,20 @@ pub struct ByteArray { } #[no_mangle] -extern "C" fn mintlayer_encode_utxo_input(data: *const u8, data_len: u32, index: u32) -> ByteArray { - let tx_hash = unsafe { core::slice::from_raw_parts(data, data_len as usize) }; - let utxo_outpoint = UtxoOutPoint::new( - OutPointSourceId::Transaction(H256(tx_hash.try_into().expect("foo"))), - index, - ); +extern "C" fn mintlayer_encode_utxo_input( + data: *const u8, + data_len: u32, + index: u32, + utxo_type: u32, +) -> ByteArray { + let hash = unsafe { core::slice::from_raw_parts(data, data_len as usize) }; + let hash = H256(hash.try_into().expect("ok")); + let outpoint = match utxo_type { + 0 => OutPointSourceId::Transaction(hash), + 1 => OutPointSourceId::BlockReward(hash), + _ => panic!("invalid utxo type"), + }; + let utxo_outpoint = UtxoOutPoint::new(outpoint, index); let tx_input = TxInput::Utxo(utxo_outpoint); let vec_data = tx_input.encode(); // Extracting the raw pointer and length from the Vec @@ -48,22 +47,116 @@ extern "C" fn mintlayer_encode_utxo_input(data: *const u8, data_len: u32, index: } } +#[no_mangle] +extern "C" fn mintlayer_encode_account_spending_input( + nonce: u64, + delegation_id_data: *const u8, + delegation_id_data_len: u32, + amount_data: *const u8, + amount_data_len: u32, +) -> ByteArray { + let delegation_id = + unsafe { core::slice::from_raw_parts(delegation_id_data, delegation_id_data_len as usize) }; + let delegation_id = H256(delegation_id.try_into().expect("ok")); + + let coin_amount = unsafe { core::slice::from_raw_parts(amount_data, amount_data_len as usize) }; + let amount = Amount::from_bytes_be(coin_amount.as_ref()).expect("fixme"); + + let tx_input = TxInput::Account(AccountOutPoint { + nonce, + account: AccountSpending::DelegationBalance(delegation_id, amount), + }); + let vec_data = tx_input.encode(); + // Extracting the raw pointer and length from the Vec + let ptr_data = vec_data.as_ptr(); + let len = vec_data.len() as cty::c_uint; + + // Prevent Rust from freeing the memory associated with vec_data + core::mem::forget(vec_data); + + // Construct and return the ByteArray struct + ByteArray { + data: ptr_data, + len, + } +} + +#[no_mangle] +extern "C" fn mintlayer_encode_account_command_input( + nonce: u64, + command: u32, + token_id_data: *const u8, + token_id_data_len: u32, + data: *const u8, + data_len: u32, +) -> ByteArray { + let token_id = + unsafe { core::slice::from_raw_parts(token_id_data, token_id_data_len as usize) }; + let token_id = H256(token_id.try_into().expect("ok")); + + let data = unsafe { core::slice::from_raw_parts(data, data_len as usize) }; + let account_command = match command { + 0 => { + let amount = Amount::from_bytes_be(data.as_ref()).expect("fixme"); + AccountCommand::MintTokens(token_id, amount) + } + 1 => AccountCommand::UnmintTokens(token_id), + 2 => AccountCommand::LockTokenSupply(token_id), + 3 => { + let is_token_unfreezabe = + IsTokenUnfreezable::decode_all(&mut data.as_ref()).expect("ok"); + AccountCommand::FreezeToken(token_id, is_token_unfreezabe) + } + 4 => AccountCommand::UnfreezeToken(token_id), + 5 => { + let destination = Destination::decode_all(&mut data.as_ref()).expect("ok"); + AccountCommand::ChangeTokenAuthority(token_id, destination) + } + _ => panic!("invalid account command"), + }; + + let tx_input = TxInput::AccountCommand(nonce, account_command); + let vec_data = tx_input.encode(); + // Extracting the raw pointer and length from the Vec + let ptr_data = vec_data.as_ptr(); + let len = vec_data.len() as cty::c_uint; + + // Prevent Rust from freeing the memory associated with vec_data + core::mem::forget(vec_data); + + // Construct and return the ByteArray struct + ByteArray { + data: ptr_data, + len, + } +} + #[no_mangle] extern "C" fn mintlayer_encode_transfer_output( amount_data: *const u8, amount_data_len: u32, + token_id_data: *const u8, + token_id_data_len: u32, destination_data: *const u8, destination_data_len: u32, ) -> ByteArray { let coin_amount = unsafe { core::slice::from_raw_parts(amount_data, amount_data_len as usize) }; - let coin_amount = from_utf8(coin_amount); let bytes = [ 2, 0, 3, 191, 111, 141, 82, 218, 222, 119, 249, 94, 156, 108, 148, 136, 253, 132, 146, 169, 156, 9, 255, 35, 9, 92, 175, 251, 46, 100, 9, 209, 116, 106, 222, ]; Destination::decode_all(&mut bytes.as_ref()).expect("ok"); - let mut destination_bytes = + let amount = Amount::from_bytes_be(coin_amount.as_ref()).expect("fixme"); + let value = if token_id_data_len == 32 { + let token_id = + unsafe { core::slice::from_raw_parts(token_id_data, token_id_data_len as usize) }; + OutputValue::TokenV1(H256(token_id.try_into().expect("already checked")), amount) + } else { + OutputValue::Coin(amount) + }; + + let destination_bytes = unsafe { core::slice::from_raw_parts(destination_data, destination_data_len as usize) }; let destination = Destination::decode_all(&mut destination_bytes.as_ref()).expect("ok"); @@ -73,12 +166,171 @@ extern "C" fn mintlayer_encode_transfer_output( // Destination::PublicKeyHash(_) => println!("pkh dest"), // }; - let txo = TxOutput::Transfer( - // OutputValue::Coin( - // Amount::from_fixedpoint_str(coin_amount.expect("fixme"), 11).expect("fixme"), - // ), - OutputValue::Coin(Amount::from_atoms(1)), - destination, + let txo = TxOutput::Transfer(value, destination); + + let vec_data = txo.encode(); + // Extracting the raw pointer and length from the Vec + let ptr_data = vec_data.as_ptr(); + let len = vec_data.len() as cty::c_uint; + + // Prevent Rust from freeing the memory associated with vec_data + core::mem::forget(vec_data); + + // Construct and return the ByteArray struct + ByteArray { + data: ptr_data, + len, + } +} + +#[no_mangle] +extern "C" fn mintlayer_encode_lock_then_transfer_output( + amount_data: *const u8, + amount_data_len: u32, + token_id_data: *const u8, + token_id_data_len: u32, + lock_type: u8, + lock_amount: u64, + destination_data: *const u8, + destination_data_len: u32, +) -> ByteArray { + let coin_amount = unsafe { core::slice::from_raw_parts(amount_data, amount_data_len as usize) }; + + let amount = Amount::from_bytes_be(coin_amount.as_ref()).expect("fixme"); + let value = if token_id_data_len == 32 { + let token_id = + unsafe { core::slice::from_raw_parts(token_id_data, token_id_data_len as usize) }; + OutputValue::TokenV1(H256(token_id.try_into().expect("already checked")), amount) + } else { + OutputValue::Coin(amount) + }; + + let destination_bytes = + unsafe { core::slice::from_raw_parts(destination_data, destination_data_len as usize) }; + let destination = Destination::decode_all(&mut destination_bytes.as_ref()).expect("ok"); + + let lock = match lock_type { + 0 => OutputTimeLock::UntilHeight(lock_amount), + 1 => OutputTimeLock::UntilTime(lock_amount), + 2 => OutputTimeLock::ForBlockCount(lock_amount), + 3 => OutputTimeLock::ForSeconds(lock_amount), + _ => panic!("unsuported lock type"), + }; + + let txo = TxOutput::LockThenTransfer(value, destination, lock); + + let vec_data = txo.encode(); + // Extracting the raw pointer and length from the Vec + let ptr_data = vec_data.as_ptr(); + let len = vec_data.len() as cty::c_uint; + + // Prevent Rust from freeing the memory associated with vec_data + core::mem::forget(vec_data); + + // Construct and return the ByteArray struct + ByteArray { + data: ptr_data, + len, + } +} + +#[no_mangle] +extern "C" fn mintlayer_encode_burn_output( + amount_data: *const u8, + amount_data_len: u32, + token_id_data: *const u8, + token_id_data_len: u32, +) -> ByteArray { + let coin_amount = unsafe { core::slice::from_raw_parts(amount_data, amount_data_len as usize) }; + + let amount = Amount::from_bytes_be(coin_amount.as_ref()).expect("fixme"); + let value = if token_id_data_len == 32 { + let token_id = + unsafe { core::slice::from_raw_parts(token_id_data, token_id_data_len as usize) }; + OutputValue::TokenV1(H256(token_id.try_into().expect("already checked")), amount) + } else { + OutputValue::Coin(amount) + }; + + let txo = TxOutput::Burn(value); + + let vec_data = txo.encode(); + // Extracting the raw pointer and length from the Vec + let ptr_data = vec_data.as_ptr(); + let len = vec_data.len() as cty::c_uint; + + // Prevent Rust from freeing the memory associated with vec_data + core::mem::forget(vec_data); + + // Construct and return the ByteArray struct + ByteArray { + data: ptr_data, + len, + } +} + +#[no_mangle] +extern "C" fn mintlayer_encode_create_stake_pool_output( + pool_id_data: *const u8, + pool_id_data_len: u32, + pledge_amount_data: *const u8, + pledge_amount_data_len: u32, + staker_destination_data: *const u8, + staker_destination_data_len: u32, + vrf_public_key_data: *const u8, + vrf_public_key_data_len: u32, + decommission_destination_data: *const u8, + decommission_destination_data_len: u32, + margin_ratio_per_thousand: u16, + cost_per_block_amount_data: *const u8, + cost_per_block_amount_data_len: u32, +) -> ByteArray { + let pool_id = unsafe { core::slice::from_raw_parts(pool_id_data, pool_id_data_len as usize) }; + let pool_id = H256(pool_id.try_into().expect("already checked")); + let coin_amount = + unsafe { core::slice::from_raw_parts(pledge_amount_data, pledge_amount_data_len as usize) }; + let pledge = Amount::from_bytes_be(coin_amount.as_ref()).expect("fixme"); + + let destination_bytes = unsafe { + core::slice::from_raw_parts( + staker_destination_data, + staker_destination_data_len as usize, + ) + }; + let staker = Destination::decode_all(&mut destination_bytes.as_ref()).expect("ok"); + + let vrf_public_key = unsafe { + core::slice::from_raw_parts(vrf_public_key_data, vrf_public_key_data_len as usize) + }; + let vrf_public_key = VRFPublicKeyHolder::Schnorrkel(VRFPublicKey( + vrf_public_key.try_into().expect("already checked"), + )); + + let destination_bytes = unsafe { + core::slice::from_raw_parts( + decommission_destination_data, + decommission_destination_data_len as usize, + ) + }; + let decommission_key = Destination::decode_all(&mut destination_bytes.as_ref()).expect("ok"); + let coin_amount = unsafe { + core::slice::from_raw_parts( + cost_per_block_amount_data, + cost_per_block_amount_data_len as usize, + ) + }; + let cost_per_block = Amount::from_bytes_be(coin_amount.as_ref()).expect("fixme"); + + let txo = TxOutput::CreateStakePool( + pool_id, + StakePoolData { + pledge, + staker, + decommission_key, + vrf_public_key, + margin_ratio_per_thousand, + cost_per_block, + }, ); let vec_data = txo.encode(); @@ -96,6 +348,293 @@ extern "C" fn mintlayer_encode_transfer_output( } } +#[no_mangle] +extern "C" fn mintlayer_encode_produce_from_stake_output( + destination_data: *const u8, + destination_data_len: u32, + pool_id_data: *const u8, + pool_id_data_len: u32, +) -> ByteArray { + let pool_id = unsafe { core::slice::from_raw_parts(pool_id_data, pool_id_data_len as usize) }; + let pool_id = H256(pool_id.try_into().expect("already checked")); + + let destination_bytes = + unsafe { core::slice::from_raw_parts(destination_data, destination_data_len as usize) }; + let destination = Destination::decode_all(&mut destination_bytes.as_ref()).expect("ok"); + + let txo = TxOutput::ProduceBlockFromStake(destination, pool_id); + + let vec_data = txo.encode(); + // Extracting the raw pointer and length from the Vec + let ptr_data = vec_data.as_ptr(); + let len = vec_data.len() as cty::c_uint; + + // Prevent Rust from freeing the memory associated with vec_data + core::mem::forget(vec_data); + + // Construct and return the ByteArray struct + ByteArray { + data: ptr_data, + len, + } +} + +#[no_mangle] +extern "C" fn mintlayer_encode_create_delegation_id_output( + destination_data: *const u8, + destination_data_len: u32, + pool_id_data: *const u8, + pool_id_data_len: u32, +) -> ByteArray { + let pool_id = unsafe { core::slice::from_raw_parts(pool_id_data, pool_id_data_len as usize) }; + let pool_id = H256(pool_id.try_into().expect("already checked")); + + let destination_bytes = + unsafe { core::slice::from_raw_parts(destination_data, destination_data_len as usize) }; + let destination = Destination::decode_all(&mut destination_bytes.as_ref()).expect("ok"); + + let txo = TxOutput::CreateDelegationId(destination, pool_id); + + let vec_data = txo.encode(); + // Extracting the raw pointer and length from the Vec + let ptr_data = vec_data.as_ptr(); + let len = vec_data.len() as cty::c_uint; + + // Prevent Rust from freeing the memory associated with vec_data + core::mem::forget(vec_data); + + // Construct and return the ByteArray struct + ByteArray { + data: ptr_data, + len, + } +} + +#[no_mangle] +extern "C" fn mintlayer_encode_delegate_staking_output( + amount_data: *const u8, + amount_data_len: u32, + delegation_id_data: *const u8, + delegation_id_data_len: u32, +) -> ByteArray { + let coin_amount = unsafe { core::slice::from_raw_parts(amount_data, amount_data_len as usize) }; + let amount = Amount::from_bytes_be(coin_amount.as_ref()).expect("fixme"); + + let delegation_id = unsafe { core::slice::from_raw_parts(delegation_id_data, delegation_id_data_len as usize) }; + let delegation_id = H256(delegation_id.try_into().expect("already checked")); + + let txo = TxOutput::DelegateStaking(amount, delegation_id); + + let vec_data = txo.encode(); + // Extracting the raw pointer and length from the Vec + let ptr_data = vec_data.as_ptr(); + let len = vec_data.len() as cty::c_uint; + + // Prevent Rust from freeing the memory associated with vec_data + core::mem::forget(vec_data); + + // Construct and return the ByteArray struct + ByteArray { + data: ptr_data, + len, + } +} + +#[no_mangle] +extern "C" fn mintlayer_encode_issue_fungible_token_output( + token_ticker_data: *const u8, + token_ticker_data_len: u32, + number_of_decimals: u8, + metadata_uri_data: *const u8, + metadata_uri_data_len: u32, + total_supply_type: u32, + fixed_amount_data: *const u8, + fixed_amount_data_len: u32, + authority_data: *const u8, + authority_data_len: u32, + is_freezable: u8, +) -> ByteArray { + let token_ticker = + unsafe { core::slice::from_raw_parts(token_ticker_data, token_ticker_data_len as usize) }; + let token_ticker = token_ticker.to_vec(); + + let metadata_uri = + unsafe { core::slice::from_raw_parts(metadata_uri_data, metadata_uri_data_len as usize) }; + let metadata_uri = metadata_uri.to_vec(); + + let authority_bytes = + unsafe { core::slice::from_raw_parts(authority_data, authority_data_len as usize) }; + let authority = Destination::decode_all(&mut authority_bytes.as_ref()).expect("ok"); + + let is_freezable = match is_freezable { + 0 => IsTokenFreezable::No, + 1 => IsTokenFreezable::Yes, + _ => panic!("invalid is token freezable type"), + }; + + let total_supply = match total_supply_type { + 0 => { + let coin_amount = unsafe { + core::slice::from_raw_parts(fixed_amount_data, fixed_amount_data_len as usize) + }; + let amount = Amount::from_bytes_be(coin_amount.as_ref()).expect("fixme"); + TokenTotalSupply::Fixed(amount) + } + 1 => TokenTotalSupply::Lockable, + 2 => TokenTotalSupply::Unlimited, + _ => panic!("invalid total supply type"), + }; + + let issuance = TokenIssuance::V1(TokenIssuanceV1 { + token_ticker, + number_of_decimals, + metadata_uri, + total_supply, + authority, + is_freezable, + }); + + let txo = TxOutput::IssueFungibleToken(issuance); + + let vec_data = txo.encode(); + // Extracting the raw pointer and length from the Vec + let ptr_data = vec_data.as_ptr(); + let len = vec_data.len() as cty::c_uint; + + // Prevent Rust from freeing the memory associated with vec_data + core::mem::forget(vec_data); + + // Construct and return the ByteArray struct + ByteArray { + data: ptr_data, + len, + } +} + +#[no_mangle] +extern "C" fn mintlayer_encode_issue_nft_output( + token_id_data: *const u8, + token_id_data_len: u32, + creator_data: *const u8, + creator_data_len: u32, + name_data: *const u8, + name_data_len: u32, + description_data: *const u8, + description_data_len: u32, + ticker_data: *const u8, + ticker_data_len: u32, + icon_uri_data: *const u8, + icon_uri_data_len: u32, + additional_metadata_uri_data: *const u8, + additional_metadata_uri_data_len: u32, + media_uri_data: *const u8, + media_uri_data_len: u32, + media_hash_data: *const u8, + media_hash_data_len: u32, + destination_data: *const u8, + destination_data_len: u32, +) -> ByteArray { + let token_id = + unsafe { core::slice::from_raw_parts(token_id_data, token_id_data_len as usize) }; + let token_id = H256(token_id.try_into().expect("already checked")); + + let creator = unsafe { core::slice::from_raw_parts(creator_data, creator_data_len as usize) }; + + let creator = if creator_data_len == 0 { + None + } else { + Some(PublicKeyHolder::Secp256k1Schnorr(PublicKey( + creator.try_into().expect("already checked"), + ))) + }; + + let name = unsafe { core::slice::from_raw_parts(name_data, name_data_len as usize) }; + let name = name.to_vec(); + + let description = + unsafe { core::slice::from_raw_parts(description_data, description_data_len as usize) }; + let description = description.to_vec(); + + let ticker = unsafe { core::slice::from_raw_parts(ticker_data, ticker_data_len as usize) }; + let ticker = ticker.to_vec(); + + let icon_uri = + unsafe { core::slice::from_raw_parts(icon_uri_data, icon_uri_data_len as usize) }; + let icon_uri = icon_uri.to_vec(); + + let additional_metadata_uri = unsafe { + core::slice::from_raw_parts( + additional_metadata_uri_data, + additional_metadata_uri_data_len as usize, + ) + }; + let additional_metadata_uri = additional_metadata_uri.to_vec(); + + let media_uri = + unsafe { core::slice::from_raw_parts(media_uri_data, media_uri_data_len as usize) }; + let media_uri = media_uri.to_vec(); + + let media_hash = + unsafe { core::slice::from_raw_parts(media_hash_data, media_hash_data_len as usize) }; + let media_hash = media_hash.to_vec(); + + let destination_bytes = + unsafe { core::slice::from_raw_parts(destination_data, destination_data_len as usize) }; + let destination = Destination::decode_all(&mut destination_bytes.as_ref()).expect("ok"); + + let issuance = NftIssuance::V0(NftIssuanceV0 { + creator, + name, + description, + ticker, + icon_uri, + additional_metadata_uri, + media_uri, + media_hash, + }); + + let txo = TxOutput::IssueNft(token_id, issuance, destination); + + let vec_data = txo.encode(); + // Extracting the raw pointer and length from the Vec + let ptr_data = vec_data.as_ptr(); + let len = vec_data.len() as cty::c_uint; + + // Prevent Rust from freeing the memory associated with vec_data + core::mem::forget(vec_data); + + // Construct and return the ByteArray struct + ByteArray { + data: ptr_data, + len, + } +} + +#[no_mangle] +extern "C" fn mintlayer_encode_data_deposit_output( + deposit_data: *const u8, + deposit_data_len: u32, +) -> ByteArray { + let deposit = unsafe { core::slice::from_raw_parts(deposit_data, deposit_data_len as usize) }; + let deposit = deposit.to_vec(); + + let txo = TxOutput::DataDeposit(deposit); + + let vec_data = txo.encode(); + // Extracting the raw pointer and length from the Vec + let ptr_data = vec_data.as_ptr(); + let len = vec_data.len() as cty::c_uint; + + // Prevent Rust from freeing the memory associated with vec_data + core::mem::forget(vec_data); + + // Construct and return the ByteArray struct + ByteArray { + data: ptr_data, + len, + } +} + #[derive(Encode, Debug, PartialEq, Eq)] struct CompactLength { #[codec(compact)] @@ -144,7 +683,7 @@ static GLOBAL_ALLOCATOR: CustomAllocator = CustomAllocator; /// /// The values of the flags are the same as in Bitcoin. #[derive(Eq, PartialEq, Clone, Copy, Debug, Ord, PartialOrd, Encode, Decode)] -pub struct SigHashType(u8); +struct SigHashType(u8); impl SigHashType { pub const ALL: u8 = 0x01; @@ -178,7 +717,7 @@ impl SigHashType { type UnsignedIntType = u128; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Encode, Decode)] -pub struct Amount { +struct Amount { #[codec(compact)] atoms: UnsignedIntType, } @@ -195,6 +734,13 @@ impl Amount { self.atoms } + pub fn from_bytes_be(bytes: &[u8]) -> Option { + bytes + .try_into() + .ok() + .map(|b| Self::from_atoms(UnsignedIntType::from_be_bytes(b))) + } + pub fn from_fixedpoint_str(amount_str: &str, decimals: u8) -> Option { amount_str .parse::() @@ -204,7 +750,7 @@ impl Amount { } #[derive(Clone, Copy, Debug)] -pub struct DecimalAmount { +struct DecimalAmount { mantissa: UnsignedIntType, decimals: u8, } @@ -272,7 +818,7 @@ fn empty_to_zero(s: &str) -> &str { } #[derive(/* thiserror::Error, */ Debug, PartialEq, Eq)] -pub enum ParseError { +enum ParseError { // #[error("Resulting number is too big")] OutOfRange, @@ -303,7 +849,7 @@ impl FromStr for DecimalAmount { let (int_str, frac_str) = s.split_once('.').unwrap_or((&s, "")); - let mut chars = int_str.chars().chain(frac_str.chars()); + // let mut chars = int_str.chars().chain(frac_str.chars()); // ensure!(chars.all(|c| c.is_ascii_digit()), ParseError::IllegalChar); // ensure!(int_str.len() + frac_str.len() > 0, ParseError::NoDigits); @@ -330,29 +876,61 @@ impl FromStr for DecimalAmount { } #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)] -pub enum OutputValue { +enum OutputValue { Coin(Amount), - // TokenV0(Box), - // TokenV1(TokenId, Amount), + TokenV0, + TokenV1(H256, Amount), +} + +#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)] +enum OutputTimeLock { + #[codec(index = 0)] + UntilHeight(#[codec(compact)] u64), + #[codec(index = 1)] + UntilTime(#[codec(compact)] u64), + #[codec(index = 2)] + ForBlockCount(#[codec(compact)] u64), + #[codec(index = 3)] + ForSeconds(#[codec(compact)] u64), +} + +#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)] +struct StakePoolData { + pledge: Amount, + staker: Destination, + vrf_public_key: VRFPublicKeyHolder, + decommission_key: Destination, + margin_ratio_per_thousand: u16, + cost_per_block: Amount, } const HASH_SIZE: usize = 20; const PK_SIZE: usize = 33; +const VRF_PK_SIZE: usize = 32; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Encode, Decode)] -pub struct PublicKeyHash(pub [u8; HASH_SIZE]); +struct PublicKeyHash(pub [u8; HASH_SIZE]); #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Encode, Decode)] -pub struct PublicKey(pub [u8; PK_SIZE]); +struct PublicKey(pub [u8; PK_SIZE]); + +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Encode, Decode)] +struct VRFPublicKey(pub [u8; VRF_PK_SIZE]); #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Decode, Encode)] -pub enum PublicKeyHolder { +enum VRFPublicKeyHolder { + #[codec(index = 0)] + Schnorrkel(VRFPublicKey), +} + +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Decode, Encode)] +enum PublicKeyHolder { #[codec(index = 0)] Secp256k1Schnorr(PublicKey), } #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Encode, Decode)] -pub enum Destination { +enum Destination { #[codec(index = 0)] AnyoneCanSpend, /* zero verification; used primarily for testing. Never use this for real * money */ @@ -366,47 +944,99 @@ pub enum Destination { // ClassicMultisig(PublicKeyHash), } +#[derive(Encode)] +enum TokenIssuance { + #[codec(index = 1)] + V1(TokenIssuanceV1), +} + +#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)] +enum IsTokenFreezable { + #[codec(index = 0)] + No, + #[codec(index = 1)] + Yes, +} + #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)] -pub enum TxOutput { +enum TokenTotalSupply { + #[codec(index = 0)] + Fixed(Amount), // fixed to a certain amount + #[codec(index = 1)] + Lockable, // not known in advance but can be locked once at some point in time + #[codec(index = 2)] + Unlimited, // limited only by the Amount data type +} + +#[derive(Encode)] +struct TokenIssuanceV1 { + pub token_ticker: parity_scale_codec::alloc::vec::Vec, + pub number_of_decimals: u8, + pub metadata_uri: parity_scale_codec::alloc::vec::Vec, + pub total_supply: TokenTotalSupply, + pub authority: Destination, + pub is_freezable: IsTokenFreezable, +} + +#[derive(Encode)] +enum NftIssuance { + #[codec(index = 0)] + V0(NftIssuanceV0), +} + +#[derive(Encode)] +struct NftIssuanceV0 { + pub creator: Option, + pub name: parity_scale_codec::alloc::vec::Vec, + pub description: parity_scale_codec::alloc::vec::Vec, + pub ticker: parity_scale_codec::alloc::vec::Vec, + pub icon_uri: parity_scale_codec::alloc::vec::Vec, + pub additional_metadata_uri: parity_scale_codec::alloc::vec::Vec, + pub media_uri: parity_scale_codec::alloc::vec::Vec, + pub media_hash: parity_scale_codec::alloc::vec::Vec, +} + +#[derive(Encode)] +enum TxOutput { /// Transfer an output, giving the provided Destination the authority to /// spend it (no conditions) #[codec(index = 0)] Transfer(OutputValue, Destination), - // /// Same as Transfer, but with the condition that an output can only be - // /// specified after some point in time. - // #[codec(index = 1)] - // LockThenTransfer(OutputValue, Destination, OutputTimeLock), - // /// Burn an amount (whether coin or token) - // #[codec(index = 2)] - // Burn(OutputValue), - // /// Output type that is used to create a stake pool - // #[codec(index = 3)] - // CreateStakePool(PoolId, Box), - // /// Output type that represents spending of a stake pool output in a - // block /// reward in order to produce a block - // #[codec(index = 4)] - // ProduceBlockFromStake(Destination, PoolId), - // /// Create a delegation; takes the owner destination (address authorized - // to /// withdraw from the delegation) and a pool id - // #[codec(index = 5)] - // CreateDelegationId(Destination, PoolId), - // /// Transfer an amount to a delegation that was previously created for - // /// staking - // #[codec(index = 6)] - // DelegateStaking(Amount, DelegationId), - // #[codec(index = 7)] - // IssueFungibleToken(Box), - // #[codec(index = 8)] - // IssueNft(TokenId, Box, Destination), - // #[codec(index = 9)] - // DataDeposit(Vec), + /// Same as Transfer, but with the condition that an output can only be + /// specified after some point in time. + #[codec(index = 1)] + LockThenTransfer(OutputValue, Destination, OutputTimeLock), + /// Burn an amount (whether coin or token) + #[codec(index = 2)] + Burn(OutputValue), + /// Output type that is used to create a stake pool + #[codec(index = 3)] + CreateStakePool(H256, StakePoolData), + /// Output type that represents spending of a stake pool output in a block + /// reward in order to produce a block + #[codec(index = 4)] + ProduceBlockFromStake(Destination, H256), + /// Create a delegation; takes the owner destination (address authorized to + /// withdraw from the delegation) and a pool id + #[codec(index = 5)] + CreateDelegationId(Destination, H256), + /// Transfer an amount to a delegation that was previously created for + /// staking + #[codec(index = 6)] + DelegateStaking(Amount, H256), + #[codec(index = 7)] + IssueFungibleToken(TokenIssuance), + #[codec(index = 8)] + IssueNft(H256, NftIssuance, Destination), + #[codec(index = 9)] + DataDeposit(parity_scale_codec::alloc::vec::Vec), } #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Debug, Encode, Decode)] -pub struct H256(pub [u8; 32]); +struct H256(pub [u8; 32]); #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode, Ord, PartialOrd)] -pub enum OutPointSourceId { +enum OutPointSourceId { #[codec(index = 0)] Transaction(H256), #[codec(index = 1)] @@ -423,7 +1053,7 @@ impl OutPointSourceId { } #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode, Ord, PartialOrd)] -pub struct UtxoOutPoint { +struct UtxoOutPoint { id: OutPointSourceId, index: u32, } @@ -445,15 +1075,60 @@ impl UtxoOutPoint { } } -#[derive(Debug, Clone, PartialEq, Eq, Ord, PartialOrd, Encode, Decode)] -pub enum TxInput { +#[derive(Encode)] +enum AccountSpending { + #[codec(index = 0)] + DelegationBalance(H256, Amount), +} + +#[derive(Encode)] +struct AccountOutPoint { + #[codec(compact)] + nonce: u64, + account: AccountSpending, +} + +#[derive(Encode, Decode)] +enum IsTokenUnfreezable { + #[codec(index = 0)] + No, + #[codec(index = 1)] + Yes, +} + +#[derive(Encode)] +enum AccountCommand { + // Create certain amount of tokens and add them to circulating supply + #[codec(index = 0)] + MintTokens(H256, Amount), + // Take tokens out of circulation. Not the same as Burn because unminting means that certain + // amount of tokens is no longer supported by underlying fiat currency, which can only be + // done by the authority. + #[codec(index = 1)] + UnmintTokens(H256), + // After supply is locked tokens cannot be minted or unminted ever again. + // Works only for Lockable tokens supply. + #[codec(index = 2)] + LockTokenSupply(H256), + // Freezing token forbids any operation with all the tokens (except for optional unfreeze) + #[codec(index = 3)] + FreezeToken(H256, IsTokenUnfreezable), + // By unfreezing token all operations are available for the tokens again + #[codec(index = 4)] + UnfreezeToken(H256), + // Change the authority who can authorize operations for a token + #[codec(index = 5)] + ChangeTokenAuthority(H256, Destination), +} + +#[derive(Encode)] +enum TxInput { #[codec(index = 0)] Utxo(UtxoOutPoint), - // // TODO: after the fork AccountOutPoint can be replaced with (AccountNonce, - // AccountSpending) #[codec(index = 1)] - // Account(AccountOutPoint), - // #[codec(index = 2)] - // AccountCommand(AccountNonce, AccountCommand), + #[codec(index = 1)] + Account(AccountOutPoint), + #[codec(index = 2)] + AccountCommand(#[codec(compact)] u64, AccountCommand), } // fn signature_hash( diff --git a/core/mocks/generated/trezormintlayer.pyi b/core/mocks/generated/trezormintlayer.pyi new file mode 100644 index 0000000000..d2306ae926 --- /dev/null +++ b/core/mocks/generated/trezormintlayer.pyi @@ -0,0 +1,115 @@ +from typing import * + + +# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +def encode_utxo_input(tx_hash: bytes, index: int, utxo_type: int) -> bytes: + """ + encodes an utxo input from tx_hash and index + """ + + +# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +def encode_account_spending_input(nonce: int, delegation_id: str, amount: +bytes) -> bytes: + """ + encodes an utxo input from tx_hash and index + """ + + +# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +def encode_account_command_input(nonce: int, command: int token_id: str, +data: bytes) -> bytes: + """ + encodes an utxo input from tx_hash and index + """ + + +# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +def encode_transfer_output(amount: str, token_id: str, address: str) -> +bytes: + """ + encodes a transfer output with given amount and destination address + """ + + +# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +def encode_lock_then_transfer_output(amount: str, token_id: str, lock_type: +int, lock_amount:int, address: str) -> bytes: + """ + encodes a transfer output with given amount and destination address + """ + + +# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +def encode_burn_output(amount: str, token_id: str) -> +bytes: + """ + encodes a transfer output with given amount and destination address + """ + + +# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +def encode_create_stake_pool_output(pool_id: str, pledge_amount: str, +staker: str, vrf_public_key: str, decommission_key: str, +margin_ratio_per_thousand: int, cost_per_block: str) -> bytes: + """ + encodes a transfer output with given amount and destination address + """ + + +# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +def encode_produce_from_stake_output(destination: str, pool_id: str) -> +bytes: + """ + encodes a transfer output with given amount and destination address + """ + + +# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +def encode_create_delegation_id_output(destination: str, pool_id: str) -> +bytes: + """ + encodes a transfer output with given amount and destination address + """ + + +# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +def encode_delegate_staking_output(amount: str, delegation_id: str) -> +bytes: + """ + encodes a transfer output with given amount and destination address + """ + + +# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +def encode_issue_fungible_token_output(token_ticker: str, +number_of_decimals: int, metadata_uri: str, total_supply_type: int, +fixed_amount: str, authority: str, is_freezable: int) -> bytes: + """ + encodes a transfer output with given amount and destination address + """ + + +# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +def encode_issue_nft_output(token_id: str, +creator: str, name: str, destination: str, +ticker: str, icon_uri: str, additional_metadata_uri: str, media_uri: str, +media_hash: str, destination: str) -> bytes: + """ + encodes a transfer output with given amount and destination address + """ + + +# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +def encode_data_deposit_output(deposit: str) -> +bytes: + """ + encodes a transfer output with given amount and destination address + """ + + +# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +def encode_compact_length(length: int) -> bytes: + """ + encodes a comapct length to bytes + """ diff --git a/core/src/all_modules.py b/core/src/all_modules.py index 3b8e8caeb0..93fd92ccb8 100644 --- a/core/src/all_modules.py +++ b/core/src/all_modules.py @@ -403,6 +403,10 @@ import trezor.enums.EthereumDefinitionType trezor.enums.MintlayerRequestType import trezor.enums.MintlayerRequestType + trezor.enums.MintlayerTokenTotalSupplyType + import trezor.enums.MintlayerTokenTotalSupplyType + trezor.enums.MintlayerUtxoType + import trezor.enums.MintlayerUtxoType trezor.enums.MoneroNetworkType import trezor.enums.MoneroNetworkType trezor.enums.NEMImportanceTransferMode @@ -549,6 +553,8 @@ import apps.mintlayer.sign_tx apps.mintlayer.sign_tx.helpers import apps.mintlayer.sign_tx.helpers + apps.mintlayer.sign_tx.layout + import apps.mintlayer.sign_tx.layout apps.mintlayer.sign_tx.progress import apps.mintlayer.sign_tx.progress apps.mintlayer.sign_tx.signer diff --git a/core/src/apps/bitcoin/sign_tx/layout.py b/core/src/apps/bitcoin/sign_tx/layout.py index fdb55141ef..809b914fe8 100644 --- a/core/src/apps/bitcoin/sign_tx/layout.py +++ b/core/src/apps/bitcoin/sign_tx/layout.py @@ -1,5 +1,6 @@ from micropython import const from typing import TYPE_CHECKING +import binascii from trezor import TR from trezor.enums import ButtonRequestType @@ -43,6 +44,23 @@ def format_coin_amount(amount: int, coin: CoinInfo, amount_unit: AmountUnit) -> elif amount_unit == AmountUnit.MILLIBITCOIN and decimals >= 3: decimals -= 3 shortcut = "m" + shortcut + elif amount_unit == AmountUnit.ML: + decimals = 11 + shortcut = "m" + shortcut + print("amount to display bytes", amount) + amount_int = 0 + for b in amount: + amount_int = (amount_int << 8) | b + decimal_str = str(amount_int) + + if len(decimal_str) <= decimals: + decimal_str = '0' * (decimals + 1 - len(decimal_str)) + decimal_str # Add an extra zero to handle leading zero case + + integer_part = decimal_str[:-decimals] or '0' + decimal_part = decimal_str[-decimals:] + return f"{integer_part}.{decimal_part} ML" + + # we don't need to do anything for AmountUnit.BITCOIN return f"{format_amount(amount, decimals)} {shortcut}" diff --git a/core/src/apps/common/keychain.py b/core/src/apps/common/keychain.py index 16913d1529..901ec0a413 100644 --- a/core/src/apps/common/keychain.py +++ b/core/src/apps/common/keychain.py @@ -137,7 +137,8 @@ def root_fingerprint(self) -> int: return self._root_fingerprint def derive(self, path: paths.Bip32Path) -> bip32.HDNode: - self.verify_path(path) + # FIXME: enable + # self.verify_path(path) return self._derive_with_cache( 3, path, diff --git a/core/src/apps/mintlayer/get_public_key.py b/core/src/apps/mintlayer/get_public_key.py index 41ee31dbc1..7cd1b6dd05 100644 --- a/core/src/apps/mintlayer/get_public_key.py +++ b/core/src/apps/mintlayer/get_public_key.py @@ -22,15 +22,10 @@ async def get_public_key( from apps.common import paths print("inside get pk of mintlayer") - res = bip32.mintlayer_from_seed(b'', b'') - print('mintlayer from seed: ', res) - - res = mintlayer_utils.encode_utxo_input(b'0'*32, 0) - print('mintlayer encode input: ', res) - - await paths.validate_path(keychain, msg.address_n) + # await paths.validate_path(keychain, msg.address_n) node = keychain.derive(msg.address_n) pubkey = node.public_key() + chain_code = node.chain_code() if msg.show_display: from . import PATTERN, SLIP44_ID @@ -42,5 +37,5 @@ async def get_public_key( path=path, ) - return MintlayerPublicKey(public_key=pubkey) + return MintlayerPublicKey(public_key=pubkey, chain_code=chain_code) diff --git a/core/src/apps/mintlayer/sign_tx/helpers.py b/core/src/apps/mintlayer/sign_tx/helpers.py index fb294dcafb..84cf3de02e 100644 --- a/core/src/apps/mintlayer/sign_tx/helpers.py +++ b/core/src/apps/mintlayer/sign_tx/helpers.py @@ -4,7 +4,7 @@ from trezor.wire import DataError from ..writers import TX_HASH_SIZE -from ...bitcoin.sign_tx import layout +from . import layout if TYPE_CHECKING: from typing import Any, Awaitable @@ -16,7 +16,8 @@ PrevTx, SignTx, TxAckPaymentRequest, - MintlayerUtxoTxInput, + MintlayerTxInput, + MintlayerTxOutput, MintlayerTransferTxOutput, TxOutput, MintlayerTxRequest, @@ -328,7 +329,7 @@ def request_tx_extra_data( return ack.tx.extra_data_chunk -def request_tx_input(tx_req: MintlayerTxRequest, i: int) -> Awaitable[MintlayerUtxoTxInput]: # type: ignore [awaitable-is-generator] +def request_tx_input(tx_req: MintlayerTxRequest, i: int) -> Awaitable[MintlayerTxInput]: # type: ignore [awaitable-is-generator] from trezor.messages import MintlayerTxAckUtxoInput assert tx_req.details is not None @@ -351,7 +352,7 @@ def request_tx_prev_input(tx_req: MintlayerTxRequest, i: int, tx_hash: bytes | N return _sanitize_tx_prev_input(ack.tx.input, coin) -def request_tx_output(tx_req: TxRequest, i: int, tx_hash: bytes | None = None) -> Awaitable[MintlayerTransferTxOutput]: # type: ignore [awaitable-is-generator] +def request_tx_output(tx_req: TxRequest, i: int, tx_hash: bytes | None = None) -> Awaitable[MintlayerTxOutput]: # type: ignore [awaitable-is-generator] from trezor.messages import MintlayerTxAckOutput assert tx_req.details is not None @@ -402,15 +403,16 @@ def _clear_tx_request(tx_req: MintlayerTxRequest) -> None: assert details is not None assert serialized is not None - assert serialized.serialized_tx is not None + # assert serialized.serialized_tx is not None tx_req.request_type = None details.request_index = None details.tx_hash = None - serialized.signature = None - serialized.signature_index = None + serialized = [] + # serialized.signature = None + # serialized.signature_index = None # typechecker thinks serialized_tx is `bytes`, which is immutable # we know that it is `bytearray` in reality - serialized.serialized_tx[:] = bytes() # type: ignore ["__setitem__" method not defined on type "bytes"] + # serialized.serialized_tx[:] = bytes() # type: ignore ["__setitem__" method not defined on type "bytes"] # Data sanitizers @@ -464,18 +466,19 @@ def _sanitize_tx_meta(tx: PrevTx, coin: CoinInfo) -> PrevTx: return tx -def _sanitize_tx_input(txi: MintlayerUtxoTxInput) -> MintlayerUtxoTxInput: +def _sanitize_tx_input(txi: MintlayerTxInput) -> MintlayerTxInput: from trezor.wire import DataError # local_cache_global - if len(txi.prev_hash) != TX_HASH_SIZE: - raise DataError("Provided prev_hash is invalid.") + if txi.utxo: + if len(txi.utxo.prev_hash) != TX_HASH_SIZE: + raise DataError("Provided prev_hash is invalid.") - # FIXME - # if not txi.multisig and script_type == InputScriptType.SPENDMULTISIG: - # raise DataError("Multisig details required.") + # FIXME + # if not txi.multisig and script_type == InputScriptType.SPENDMULTISIG: + # raise DataError("Multisig details required.") - if txi.address_n: - raise DataError("Input's address_n provided but not expected.") + # if txi.utxo.address_n: + # raise DataError("Input's address_n provided but not expected.") return txi @@ -490,18 +493,22 @@ def _sanitize_tx_prev_input(txi: PrevInput, coin: CoinInfo) -> PrevInput: return txi -def _sanitize_tx_output(txo: MintlayerTransferTxOutput) -> TxOutput: +def _sanitize_tx_output(txo: MintlayerTxOutput) -> MintlayerTxOutput: from trezor.wire import DataError # local_cache_global - address_n = txo.address_n # local_cache_attribute + if txo.transfer: + address_n = txo.transfer.address_n # local_cache_attribute - if txo.amount is None: - raise DataError("Missing amount field.") + if txo.transfer.value is None: + raise DataError("Missing amount field.") - if address_n and txo.address: - raise DataError("Both address and address_n provided.") - if not address_n and not txo.address: - raise DataError("Missing address") + if address_n and txo.transfer.address: + raise DataError("Both address and address_n provided.") + if not address_n and not txo.transfer.address: + raise DataError("Missing address") + else: + # TODO: senitize other tx outputs + pass return txo diff --git a/core/src/apps/mintlayer/sign_tx/layout.py b/core/src/apps/mintlayer/sign_tx/layout.py new file mode 100644 index 0000000000..92e1fbfafc --- /dev/null +++ b/core/src/apps/mintlayer/sign_tx/layout.py @@ -0,0 +1,342 @@ +from micropython import const +from typing import TYPE_CHECKING + +from trezor import TR +from trezor.enums import ButtonRequestType +from trezor.strings import format_amount +from trezor.ui import layouts +from trezor.ui.layouts import confirm_metadata + +from apps.common.paths import address_n_to_str + +from trezor.crypto.bech32 import bech32_encode, bech32_decode, convertbits, reverse_convertbits, decode_address_to_bytes, Encoding + +from ...bitcoin import addresses +from ...bitcoin.common import ( + BIP32_WALLET_DEPTH, + CHANGE_OUTPUT_TO_INPUT_SCRIPT_TYPES, + format_fee_rate, +) +# from ..keychain import address_n_to_name + +if TYPE_CHECKING: + from trezor.enums import AmountUnit + from trezor.messages import TxAckPaymentRequest, TxOutput + from trezor.ui.layouts import LayoutType + + from apps.common.coininfo import CoinInfo + from apps.common.paths import Bip32Path + + from trezor.messages import ( + MintlayerTxOutput, + ) + +_LOCKTIME_TIMESTAMP_MIN_VALUE = const(500_000_000) + + +def format_coin_amount(amount: bytes, token_id: bytes | None) -> str: + if token_id is None: + decimals = 11 + name = "ML" + else: + decimals = 0 + name = "Token" + + print("amount to display bytes", amount) + amount_int = 0 + for b in amount: + amount_int = (amount_int << 8) | b + decimal_str = str(amount_int) + + if len(decimal_str) <= decimals: + decimal_str = '0' * (decimals + 1 - len(decimal_str)) + decimal_str # Add an extra zero to handle leading zero case + + integer_part = decimal_str[:-decimals] or '0' + decimal_part = decimal_str[-decimals:] + return f"{integer_part}.{decimal_part} {name}" + + +def account_label(coin: CoinInfo, address_n: Bip32Path | None) -> str: + return ( + TR.bitcoin__multiple_accounts + if address_n is None + else address_n_to_name(coin, list(address_n) + [0] * BIP32_WALLET_DEPTH) + or f"Path {address_n_to_str(address_n)}" + ) + + +async def confirm_output( + output: MintlayerTxOutput, + coin: CoinInfo, + amount_unit: AmountUnit, + output_index: int, + chunkify: bool, +) -> None: + title = TR.bitcoin__title_confirm_details + if output.transfer: + x = output.transfer + assert x.address is not None + address_short = x.address + amount = format_coin_amount(x.value.amount, x.value.token_id) + address_label = "Transfer" + elif output.lock_then_transfer: + x = output.lock_then_transfer + assert x.address is not None + address_label = "Lock then Transfer" + address_short = f"Destination: {x.address}\n" + if x.lock.until_time: + address_label = f"Lock until {x.lock.until_time} time" + elif x.lock.until_height: + address_label = f"Lock until {x.lock.until_height} height" + elif x.lock.for_seconds: + address_label = f"Lock for {x.lock.for_seconds} seconds" + elif x.lock.for_block_count: + address_label = f"Lock for {x.lock.for_block_count} blocks" + else: + raise Exception("unhandled lock type") + amount = format_coin_amount(x.value.amount, x.value.token_id) + elif output.burn: + x = output.burn + address_short = "BURN" + amount = format_coin_amount(x.value.amount, x.value.token_id) + address_label = None + elif output.create_stake_pool: + x = output.create_stake_pool + assert x.staker is not None and x.decommission_key is not None + address_short = f"staker: {x.staker}, decommission_key: {x.decommission_key}" + amount = format_coin_amount(x.pledge, None) + address_label = "Create stake pool" + elif output.create_delegation_id: + x = output.create_delegation_id + assert x.destination is not None + amount = "" + data = convertbits(x.pool_id, 8, 5) + address = bech32_encode("mpool", data, Encoding.BECH32M) + address_short = f"{x.destination} {address}" + address_label = f"Create delegation ID" + elif output.delegate_staking: + x = output.delegate_staking + assert x.delegation_id is not None + data = convertbits(x.delegation_id, 8, 5) + address = bech32_encode("mdeleg", data, Encoding.BECH32M) + address_short = address + amount = format_coin_amount(x.amount, None) + address_label = "Delegation staking" + elif output.issue_fungible_token: + x = output.issue_fungible_token + address_short = "Issue Fungible Token" + amount = "amount" + address_label = "Issue fungible token" + elif output.issue_nft: + x = output.issue_nft + address_short = x.destination + amount = "" + address_label = "Issue NFT token" + else: + raise Exception("unhandled output type") + + layout = layouts.confirm_output( + address_short, + amount, + title=title, + address_label=address_label, + output_index=output_index, + chunkify=chunkify, + ) + + await layout + + +async def confirm_decred_sstx_submission( + output: TxOutput, coin: CoinInfo, amount_unit: AmountUnit +) -> None: + assert output.address is not None + address_short = addresses.address_short(coin, output.address) + amount = format_coin_amount(output.amount, coin, amount_unit) + + await layouts.confirm_value( + TR.bitcoin__title_purchase_ticket, + amount, + TR.bitcoin__ticket_amount, + "confirm_decred_sstx_submission", + ButtonRequestType.ConfirmOutput, + verb=TR.buttons__confirm, + ) + + await layouts.confirm_value( + TR.bitcoin__title_purchase_ticket, + address_short, + TR.bitcoin__voting_rights, + "confirm_decred_sstx_submission", + ButtonRequestType.ConfirmOutput, + verb=TR.buttons__purchase, + ) + + +async def should_show_payment_request_details( + msg: TxAckPaymentRequest, + coin: CoinInfo, + amount_unit: AmountUnit, +) -> bool: + from trezor import wire + + memo_texts: list[str] = [] + for m in msg.memos: + if m.text_memo is not None: + memo_texts.append(m.text_memo.text) + elif m.refund_memo is not None: + pass + elif m.coin_purchase_memo is not None: + memo_texts.append(f"{TR.words__buying} {m.coin_purchase_memo.amount}.") + else: + raise wire.DataError("Unrecognized memo type in payment request memo.") + + assert msg.amount is not None + + return await layouts.should_show_payment_request_details( + msg.recipient_name, + format_coin_amount(msg.amount, coin, amount_unit), + memo_texts, + ) + + +async def confirm_replacement(title: str, txid: bytes) -> None: + from ubinascii import hexlify + + await layouts.confirm_replacement( + title, + hexlify(txid).decode(), + ) + + +async def confirm_modify_output( + txo: TxOutput, + orig_txo: TxOutput, + coin: CoinInfo, + amount_unit: AmountUnit, +) -> None: + assert txo.address is not None + address_short = addresses.address_short(coin, txo.address) + amount_change = txo.amount - orig_txo.amount + await layouts.confirm_modify_output( + address_short, + amount_change, + format_coin_amount(abs(amount_change), coin, amount_unit), + format_coin_amount(txo.amount, coin, amount_unit), + ) + + +async def confirm_modify_fee( + title: str, + user_fee_change: int, + total_fee_new: int, + fee_rate: float, + coin: CoinInfo, + amount_unit: AmountUnit, +) -> None: + await layouts.confirm_modify_fee( + title, + user_fee_change, + format_coin_amount(abs(user_fee_change), coin, amount_unit), + format_coin_amount(total_fee_new, coin, amount_unit), + fee_rate_amount=format_fee_rate(fee_rate, coin) if fee_rate >= 0 else None, + ) + + +async def confirm_joint_total( + spending: int, + total: int, + coin: CoinInfo, + amount_unit: AmountUnit, +) -> None: + await layouts.confirm_joint_total( + spending_amount=format_coin_amount(spending, coin, amount_unit), + total_amount=format_coin_amount(total, coin, amount_unit), + ) + + +async def confirm_total( + spending: int, + fee: int, + fee_rate: float, + coin: CoinInfo, + amount_unit: AmountUnit, + address_n: Bip32Path | None, +) -> None: + + await layouts.confirm_total( + format_coin_amount(spending.to_bytes(16, 'big'), None), + format_coin_amount(fee.to_bytes(16, 'big'), None), + fee_rate_amount=format_fee_rate(fee_rate, coin) if fee_rate >= 0 else None, + account_label=account_label(coin, address_n), + ) + + +async def confirm_feeoverthreshold( + fee: int, coin: CoinInfo, amount_unit: AmountUnit +) -> None: + fee_amount = format_coin_amount(fee, coin, amount_unit) + await layouts.show_warning( + "fee_over_threshold", + TR.bitcoin__unusually_high_fee, + fee_amount, + br_code=ButtonRequestType.FeeOverThreshold, + ) + + +async def confirm_change_count_over_threshold(change_count: int) -> None: + await layouts.show_warning( + "change_count_over_threshold", + TR.bitcoin__lot_of_change_outputs, + f"{str(change_count)} {TR.words__outputs}", + br_code=ButtonRequestType.SignTx, + ) + + +async def confirm_unverified_external_input() -> None: + await layouts.show_warning( + "unverified_external_input", + TR.bitcoin__unverified_external_inputs, + TR.words__continue_anyway, + button=TR.buttons__continue, + br_code=ButtonRequestType.SignTx, + ) + + +async def confirm_multiple_accounts() -> None: + await layouts.show_warning( + "sending_from_multiple_accounts", + TR.send__from_multiple_accounts, + TR.words__continue_anyway, + button=TR.buttons__continue, + br_code=ButtonRequestType.SignTx, + ) + + +async def confirm_nondefault_locktime(lock_time: int, lock_time_disabled: bool) -> None: + from trezor.strings import format_timestamp + + if lock_time_disabled: + await layouts.show_warning( + "nondefault_locktime", + TR.bitcoin__locktime_no_effect, + TR.words__continue_anyway, + button=TR.buttons__continue, + br_code=ButtonRequestType.SignTx, + ) + else: + if lock_time < _LOCKTIME_TIMESTAMP_MIN_VALUE: + text = TR.bitcoin__locktime_set_to_blockheight + value = str(lock_time) + else: + text = TR.bitcoin__locktime_set_to + value = format_timestamp(lock_time) + await layouts.confirm_value( + TR.bitcoin__confirm_locktime, + value, + text, + "nondefault_locktime", + br_code=ButtonRequestType.SignTx, + verb=TR.buttons__confirm, + ) + diff --git a/core/src/apps/mintlayer/sign_tx/signer.py b/core/src/apps/mintlayer/sign_tx/signer.py index 9ff7f64f06..04d33c3766 100644 --- a/core/src/apps/mintlayer/sign_tx/signer.py +++ b/core/src/apps/mintlayer/sign_tx/signer.py @@ -1,6 +1,6 @@ from apps.common.coininfo import by_name -from trezor.crypto.bech32 import bech32_encode, bech32_decode, convertbits, reverse_convertbits, Encoding -from trezor.messages import MintlayerSignTx, MintlayerUtxoTxInput, MintlayerTransferTxOutput +from trezor.crypto.bech32 import bech32_encode, bech32_decode, convertbits, reverse_convertbits, decode_address_to_bytes, Encoding +from trezor.messages import MintlayerSignTx, MintlayerTxRequestSerializedType, MintlayerTxInput, MintlayerTxOutput from micropython import const from typing import TYPE_CHECKING @@ -36,23 +36,23 @@ _SERIALIZED_TX_BUFFER = empty_bytearray(_MAX_SERIALIZED_CHUNK_SIZE) class TxUtxoInput: - def __init__(self, input: MintlayerUtxoTxInput, utxo: MintlayerTransferTxOutput, node: bip32.HDNode): + def __init__(self, input: MintlayerTxInput, utxo: MintlayerTxOutput | None, node: bip32.HDNode | None): self.input = input self.utxo = utxo self.node = node class TxInfo: - def __init__(self, tx: MintlayerSignTx, inputs: List[TxUtxoInput], outputs: List[MintlayerTransferTxOutput]): + def __init__(self, tx: MintlayerSignTx, inputs: List[TxUtxoInput], outputs: List[MintlayerTxOutput]): self.tx = tx self.inputs = inputs self.outputs = outputs - def add_input(self, txi: MintlayerUtxoTxInput, txo: MintlayerTransferTxOutput, node: bip32.HDNode): + def add_input(self, txi: MintlayerTxInput, txo: MintlayerTxOutput | None, node: bip32.HDNode | None): self.inputs.append(TxUtxoInput(input= txi, utxo= txo, node= node)) - def add_output(self, txo: MintlayerTransferTxOutput): + def add_output(self, txo: MintlayerTxOutput): self.outputs.append(txo) class Mintlayer: @@ -72,9 +72,8 @@ async def signer(self) -> None: # Add outputs to sig_hasher and h_tx_check, approve outputs and compute # sum of output amounts. - await self.step2_approve_outputs() + total = await self.step2_approve_outputs() - total = 10 fee = 1 fee_rate = 0.1 coin = by_name('Bitcoin') @@ -156,8 +155,10 @@ def __init__( self.serialize = tx.serialize self.tx_req = MintlayerTxRequest() self.tx_req.details = TxRequestDetailsType() - self.tx_req.serialized = TxRequestSerializedType() - self.tx_req.serialized.serialized_tx = self.serialized_tx + self.tx_req.serialized = [] + # TODO-BO: do we need this? + # self.tx_req.serialized = TxRequestSerializedType() + # self.tx_req.serialized.serialized_tx = self.serialized_tx # The digest of the presigned external inputs streamed for approval in Step 1. This is # used to ensure that the inputs streamed for verification in Step 3 are the same as @@ -179,26 +180,49 @@ async def step1_process_inputs(self) -> None: progress.advance() # get the input txi = await helpers.request_tx_input(self.tx_req, i) - # get the utxo - txo = await helpers.request_tx_output(self.tx_req, txi.prev_index, txi.prev_hash) - node = self.keychain.derive(txo.address_n) - - self.tx_info.add_input(txi, txo, node) + if txi.utxo: + # get the utxo + txo = await helpers.request_tx_output(self.tx_req, txi.utxo.prev_index, txi.utxo.prev_hash) + if txi.utxo.address_n: + node = self.keychain.derive(txi.utxo.address_n) + else: + node = None + + self.tx_info.add_input(txi, txo, node) + elif txi.account: + # get the utxo + if txi.account.address_n: + node = self.keychain.derive(txi.account.address_n) + else: + node = None + self.tx_info.add_input(txi, None, node) + elif txi.account_command: + # get the utxo + if txi.account_command.address_n: + node = self.keychain.derive(txi.account_command.address_n) + else: + node = None + self.tx_info.add_input(txi, None, node) + else: + # TODO: handle other input types + raise Exception("Unhandled tx input type") # tx_info.h_inputs_check = tx_info.get_tx_check_digest() # self.h_presigned_inputs = h_presigned_inputs_check.get_digest() - async def step2_approve_outputs(self) -> None: - from trezor.messages import TxOutput + async def step2_approve_outputs(self) -> int: + total = 0 for i in range(self.tx_info.tx.outputs_count): # STAGE_REQUEST_2_OUTPUT in legacy progress.advance() txo = await helpers.request_tx_output(self.tx_req, i) coin = by_name('Bitcoin') - amount_unit = AmountUnit.BITCOIN - t = TxOutput(amount=txo.amount, address=txo.address) - await helpers.confirm_output(t, coin, amount_unit, i, False) + amount_unit = AmountUnit.ML + await helpers.confirm_output(txo, coin, amount_unit, i, False) + if txo.transfer: + total += int.from_bytes(txo.transfer.value.amount, 'big') self.tx_info.add_output(txo) + return total async def step3_verify_inputs(self) -> None: return @@ -208,44 +232,149 @@ async def step4_serialize_inputs(self) -> Tuple[List[bytes], List[bytes]]: encoded_input_utxos = [] for inp in self.tx_info.inputs: progress.advance() - encoded_inp = mintlayer_utils.encode_utxo_input(inp.input.prev_hash, inp.input.prev_index) - encoded_inputs.append(encoded_inp) - - pk = bytes([0]) + inp.node.public_key() - hrp = 'mptc' - hrp = 'mtc' - - pkh = blake2b(pk).digest()[:20] + if inp.input.utxo and inp.utxo: + x = inp.input.utxo + encoded_inp = mintlayer_utils.encode_utxo_input(x.prev_hash, x.prev_index, int(x.type)) + encoded_inputs.append(encoded_inp) + if inp.node: + pk = bytes([0]) + inp.node.public_key() + print("pk", pk) + hrp = 'mptc' + hrp = 'mtc' + + pkh = blake2b(pk).digest()[:20] + + data = convertbits(bytes([1])+pkh, 8, 5) + address = bech32_encode(hrp, data, Encoding.BECH32M) + + data = decode_address_to_bytes(address) + + print(f'addr: {address} bytes: {data}') + encoded_inp_utxo = self.serialize_output(inp.utxo) + encoded_input_utxos.append(b'\x01' + encoded_inp_utxo) + else: + data = decode_address_to_bytes(x.address) + + encoded_inp_utxo = self.serialize_output(inp.utxo) + encoded_input_utxos.append(b'\x01' + encoded_inp_utxo) + elif inp.input.account: + x = inp.input.account + encoded_inp = mintlayer_utils.encode_account_spending_input(x.nonce, x.delegation_id, x.value.amount) + encoded_inputs.append(encoded_inp) + encoded_input_utxos.append(b'\x00') + elif inp.input.account_command: + x = inp.input.account_command + if x.mint: + command = 0 + token_id = x.mint.token_id + data = x.mint.amount + elif x.unmint: + command = 1 + token_id = x.unmint.token_id + data = b'' + elif x.lock_token_supply: + command = 2 + token_id = x.lock_token_supply.token_id + data = b'' + elif x.freeze_token: + command = 3 + token_id = x.freeze_token.token_id + data = int(x.freeze_token.is_token_unfreezabe).to_bytes(1, 'big') + elif x.unfreeze_token: + command = 4 + token_id = x.unfreeze_token.token_id + data = b'' + elif x.change_token_authority: + command = 5 + token_id = x.change_token_authority.token_id + data = decode_address_to_bytes(x.change_token_authority.destination) + else: + raise Exception("unknown account command") + + encoded_inp = mintlayer_utils.encode_account_command_input(x.nonce, command, token_id, data) + encoded_inputs.append(encoded_inp) + encoded_input_utxos.append(b'\x00') - data = convertbits(bytes([1])+pkh, 8, 5) - address = bech32_encode(hrp, data, Encoding.BECH32M) - _, data = bech32_decode(address) - data = reverse_convertbits(data, 8, 5) + return encoded_inputs, encoded_input_utxos - encoded_inp_utxo = mintlayer_utils.encode_transfer_output(str(inp.utxo.amount).encode(), bytes(data)) - encoded_input_utxos.append(b'\x01' + encoded_inp_utxo) + def serialize_output(self, out: MintlayerTxOutput) -> bytes: + if out.transfer: + x = out.transfer + data = decode_address_to_bytes(x.address) + print(f'addr: {x.address} bytes: {data}') + encoded_out = mintlayer_utils.encode_transfer_output(x.value.amount, x.value.token_id or b'', data) + elif out.lock_then_transfer: + x = out.lock_then_transfer + data = decode_address_to_bytes(x.address) + if x.lock.until_height: + lock_type = 0 + lock_amount = x.lock.until_time + elif x.lock.until_time: + lock_type = 1 + lock_amount = x.lock.until_time + elif x.lock.for_block_count: + lock_type = 2 + lock_amount = x.lock.for_block_count + elif x.lock.for_seconds: + lock_type = 3 + lock_amount = x.lock.for_seconds + else: + raise Exception("no lock type was specified for lock then transfer output") + print(dir(mintlayer_utils)) + encoded_out = mintlayer_utils.encode_lock_then_transfer_output(x.value.amount, x.value.token_id or b'', lock_type, lock_amount, data) + elif out.burn: + x = out.burn + encoded_out = mintlayer_utils.encode_burn_output(x.value.amount, x.value.token_id or b'') + elif out.create_stake_pool: + x = out.create_stake_pool + staker = decode_address_to_bytes(x.staker) + vrf_public_key = decode_address_to_bytes(x.vrf_public_key) + decommission_key = decode_address_to_bytes(x.decommission_key) + encoded_out = mintlayer_utils.encode_create_stake_pool_output(x.pool_id, x.pledge, staker, vrf_public_key, decommission_key, x.margin_ratio_per_thousand, x.cost_per_block) + elif out.create_delegation_id: + x = out.create_delegation_id + destination = decode_address_to_bytes(x.destination) + encoded_out = mintlayer_utils.encode_create_delegation_id_output(destination, x.pool_id) + elif out.delegate_staking: + x = out.delegate_staking + encoded_out = mintlayer_utils.encode_delegate_staking_output(x.amount, x.delegation_id) + elif out.produce_block_from_stake: + x = out.produce_block_from_stake + destination = decode_address_to_bytes(x.destination) + encoded_out = mintlayer_utils.encode_produce_from_stake_output(destination, x.pool_id) + elif out.issue_fungible_token: + x = out.issue_fungible_token + authority = decode_address_to_bytes(x.authority) + encoded_out = mintlayer_utils.encode_issue_fungible_token_output(x.token_ticker, x.number_of_decimals, x.metadata_uri, x.total_supply.type, x.total_supply.fixed_amount, authority, int(x.is_freezable)) + elif out.issue_nft: + x = out.issue_nft + creator = decode_address_to_bytes(x.creator) + destination = decode_address_to_bytes(x.destination) + encoded_out = mintlayer_utils.encode_issue_nft_output(x.token_id, creator, x.name, x.destination, x.ticker, x.icon_uri, x.additional_metadata_uri, x.media_uri, x.media_hash, destination) + else: + raise Exception("unhandled tx output type") + return encoded_out - return encoded_inputs, encoded_input_utxos async def step5_serialize_outputs(self) -> List[bytes]: encoded_outputs = [] for out in self.tx_info.outputs: progress.advance() - hpr, data = bech32_decode(out.address) - data = reverse_convertbits(data, 8, 5) - print('decoded out', hpr, data) - - encoded_out = mintlayer_utils.encode_transfer_output(str(out.amount).encode(), bytes(data)) + encoded_out = self.serialize_output(out) encoded_outputs.append(encoded_out) return encoded_outputs - async def step6_sign_inputs(self, encoded_inputs: List[bytes], encoded_input_utxos: Lisst[bytes], encoded_outputs: Lisst[bytes]) -> List[butes]: + async def step6_sign_inputs(self, encoded_inputs: List[bytes], encoded_input_utxos: List[bytes], encoded_outputs: List[bytes]) -> List[bytes | None]: from trezor.utils import HashWriter signatures = [] for i in range(self.tx_info.tx.inputs_count): + node = self.tx_info.inputs[i].node + if node is None: + signatures.append(None) + continue writer = HashWriter(blake2b()) # mode writer.extend(b'\x01') @@ -257,6 +386,7 @@ async def step6_sign_inputs(self, encoded_inputs: List[bytes], encoded_input_utx writer.extend(len(encoded_inputs).to_bytes(4, 'little')) + print(f'encoded inputs {encoded_inputs}') for inp in encoded_inputs: writer.extend(inp) @@ -267,12 +397,13 @@ async def step6_sign_inputs(self, encoded_inputs: List[bytes], encoded_input_utx encoded_len = mintlayer_utils.encode_compact_length(len(encoded_outputs)) print(f'compact len {encoded_len}') + print(f'encoded outputs {encoded_outputs}') writer.extend(encoded_len) for out in encoded_outputs: writer.extend(out) hash = writer.get_digest()[:32] - private_key = self.tx_info.inputs[i].node.private_key() + private_key = node.private_key() digest = blake2b(hash).digest()[:32] print(f"hash {list(hash)}, digest {list(digest)}") @@ -282,7 +413,9 @@ async def step6_sign_inputs(self, encoded_inputs: List[bytes], encoded_input_utx return signatures - async def step7_finish(self, signatures: List[bytes]) -> None: + async def step7_finish(self, signatures: List[bytes | None]) -> None: + sigs = [MintlayerTxRequestSerializedType(signature_index=i, signature=sig) for i, sig in enumerate(signatures)] + self.tx_req.serialized = sigs # if self.serialize: # self.write_tx_footer(self.serialized_tx, self.tx_info.tx) # if __debug__: @@ -309,14 +442,14 @@ async def write_prev_tx_footer( ) -> None: self.write_tx_footer(w, tx) - def set_serialized_signature(self, index: int, signature: bytes) -> None: - from trezor.utils import ensure + # def set_serialized_signature(self, index: int, signature: bytes) -> None: + # from trezor.utils import ensure - serialized = self.tx_req.serialized # local_cache_attribute + # serialized = self.tx_req.serialized # local_cache_attribute - # Only one signature per TxRequest can be serialized. - assert serialized is not None - ensure(serialized.signature is None) + # # Only one signature per TxRequest can be serialized. + # assert serialized is not None + # ensure(serialized.signature is None) - serialized.signature_index = index - serialized.signature = signature + # serialized.signature_index = index + # serialized.signature = signature diff --git a/core/src/trezor/crypto/bech32.py b/core/src/trezor/crypto/bech32.py index 94352ef31d..145881a1b5 100644 --- a/core/src/trezor/crypto/bech32.py +++ b/core/src/trezor/crypto/bech32.py @@ -180,6 +180,13 @@ def reverse_convertbits( ret.append((acc >> bits) & maxv) return ret +def decode_address_to_bytes(address: str | None) -> bytes: + if address is None: + return bytes() + + _, data = bech32_decode(address) + data = reverse_convertbits(data, 8, 5) + return bytes(data) def decode(hrp: str, addr: str) -> OptionalTuple2[int, bytes]: diff --git a/core/src/trezor/enums/AmountUnit.py b/core/src/trezor/enums/AmountUnit.py index efac9ed76b..9cd7298003 100644 --- a/core/src/trezor/enums/AmountUnit.py +++ b/core/src/trezor/enums/AmountUnit.py @@ -6,3 +6,4 @@ MILLIBITCOIN = 1 MICROBITCOIN = 2 SATOSHI = 3 +ML = 4 diff --git a/core/src/trezor/enums/MintlayerTokenTotalSupplyType.py b/core/src/trezor/enums/MintlayerTokenTotalSupplyType.py new file mode 100644 index 0000000000..c8a8ec6016 --- /dev/null +++ b/core/src/trezor/enums/MintlayerTokenTotalSupplyType.py @@ -0,0 +1,7 @@ +# Automatically generated by pb2py +# fmt: off +# isort:skip_file + +FIXED = 0 +LOCKABLE = 1 +UNLIMITED = 2 diff --git a/core/src/trezor/enums/MintlayerUtxoType.py b/core/src/trezor/enums/MintlayerUtxoType.py new file mode 100644 index 0000000000..434d1da7e3 --- /dev/null +++ b/core/src/trezor/enums/MintlayerUtxoType.py @@ -0,0 +1,6 @@ +# Automatically generated by pb2py +# fmt: off +# isort:skip_file + +TRANSACTION = 0 +BLOCK = 1 diff --git a/core/src/trezor/enums/__init__.py b/core/src/trezor/enums/__init__.py index 1301f7d4dc..da49a0f7d6 100644 --- a/core/src/trezor/enums/__init__.py +++ b/core/src/trezor/enums/__init__.py @@ -346,6 +346,7 @@ class AmountUnit(IntEnum): MILLIBITCOIN = 1 MICROBITCOIN = 2 SATOSHI = 3 + ML = 4 class RequestType(IntEnum): TXINPUT = 0 @@ -506,6 +507,15 @@ class EthereumDataType(IntEnum): ARRAY = 7 STRUCT = 8 + class MintlayerUtxoType(IntEnum): + TRANSACTION = 0 + BLOCK = 1 + + class MintlayerTokenTotalSupplyType(IntEnum): + FIXED = 0 + LOCKABLE = 1 + UNLIMITED = 2 + class MintlayerRequestType(IntEnum): TXINPUT = 0 TXOUTPUT = 1 diff --git a/core/src/trezor/messages.py b/core/src/trezor/messages.py index 0dca839344..35c207a81a 100644 --- a/core/src/trezor/messages.py +++ b/core/src/trezor/messages.py @@ -46,6 +46,8 @@ def __getattr__(name: str) -> Any: from trezor.enums import InputScriptType # noqa: F401 from trezor.enums import MessageType # noqa: F401 from trezor.enums import MintlayerRequestType # noqa: F401 + from trezor.enums import MintlayerTokenTotalSupplyType # noqa: F401 + from trezor.enums import MintlayerUtxoType # noqa: F401 from trezor.enums import MoneroNetworkType # noqa: F401 from trezor.enums import NEMImportanceTransferMode # noqa: F401 from trezor.enums import NEMModificationType # noqa: F401 @@ -4046,11 +4048,13 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerGetPublicKey"]: class MintlayerPublicKey(protobuf.MessageType): public_key: "bytes" + chain_code: "bytes" def __init__( self, *, public_key: "bytes", + chain_code: "bytes", ) -> None: pass @@ -4101,14 +4105,14 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerSignTx"]: class MintlayerTxRequest(protobuf.MessageType): request_type: "MintlayerRequestType | None" details: "MintlayerTxRequestDetailsType | None" - serialized: "MintlayerTxRequestSerializedType | None" + serialized: "list[MintlayerTxRequestSerializedType]" def __init__( self, *, + serialized: "list[MintlayerTxRequestSerializedType] | None" = None, request_type: "MintlayerRequestType | None" = None, details: "MintlayerTxRequestDetailsType | None" = None, - serialized: "MintlayerTxRequestSerializedType | None" = None, ) -> None: pass @@ -4116,19 +4120,41 @@ def __init__( def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerTxRequest"]: return isinstance(msg, cls) + class MintlayerTxInput(protobuf.MessageType): + utxo: "MintlayerUtxoTxInput | None" + account: "MintlayerAccountTxInput | None" + account_command: "MintlayerAccountCommandTxInput | None" + + def __init__( + self, + *, + utxo: "MintlayerUtxoTxInput | None" = None, + account: "MintlayerAccountTxInput | None" = None, + account_command: "MintlayerAccountCommandTxInput | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerTxInput"]: + return isinstance(msg, cls) + class MintlayerUtxoTxInput(protobuf.MessageType): address_n: "list[int]" + address: "str" prev_hash: "bytes" prev_index: "int" + type: "MintlayerUtxoType" sequence: "int" - amount: "int" + value: "MintlayerOutputValue" def __init__( self, *, + address: "str", prev_hash: "bytes", prev_index: "int", - amount: "int", + type: "MintlayerUtxoType", + value: "MintlayerOutputValue", address_n: "list[int] | None" = None, sequence: "int | None" = None, ) -> None: @@ -4138,15 +4164,209 @@ def __init__( def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerUtxoTxInput"]: return isinstance(msg, cls) + class MintlayerAccountTxInput(protobuf.MessageType): + address_n: "list[int]" + address: "str" + sequence: "int" + value: "MintlayerOutputValue" + nonce: "int" + delegation_id: "bytes" + + def __init__( + self, + *, + address: "str", + value: "MintlayerOutputValue", + nonce: "int", + delegation_id: "bytes", + address_n: "list[int] | None" = None, + sequence: "int | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerAccountTxInput"]: + return isinstance(msg, cls) + + class MintlayerAccountCommandTxInput(protobuf.MessageType): + address_n: "list[int]" + address: "str" + sequence: "int" + nonce: "int" + mint: "MintlayerMintTokens | None" + unmint: "MintlayerUnmintTokens | None" + lock_token_supply: "MintlayerLockTokenSupply | None" + freeze_token: "MintlayerFreezeToken | None" + unfreeze_token: "MintlayerUnfreezeToken | None" + change_token_authority: "MintlayerChangeTokenAuhtority | None" + + def __init__( + self, + *, + address: "str", + nonce: "int", + address_n: "list[int] | None" = None, + sequence: "int | None" = None, + mint: "MintlayerMintTokens | None" = None, + unmint: "MintlayerUnmintTokens | None" = None, + lock_token_supply: "MintlayerLockTokenSupply | None" = None, + freeze_token: "MintlayerFreezeToken | None" = None, + unfreeze_token: "MintlayerUnfreezeToken | None" = None, + change_token_authority: "MintlayerChangeTokenAuhtority | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerAccountCommandTxInput"]: + return isinstance(msg, cls) + + class MintlayerMintTokens(protobuf.MessageType): + token_id: "bytes" + amount: "bytes" + + def __init__( + self, + *, + token_id: "bytes", + amount: "bytes", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerMintTokens"]: + return isinstance(msg, cls) + + class MintlayerUnmintTokens(protobuf.MessageType): + token_id: "bytes" + + def __init__( + self, + *, + token_id: "bytes", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerUnmintTokens"]: + return isinstance(msg, cls) + + class MintlayerLockTokenSupply(protobuf.MessageType): + token_id: "bytes" + + def __init__( + self, + *, + token_id: "bytes", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerLockTokenSupply"]: + return isinstance(msg, cls) + + class MintlayerFreezeToken(protobuf.MessageType): + token_id: "bytes" + is_token_unfreezabe: "bool" + + def __init__( + self, + *, + token_id: "bytes", + is_token_unfreezabe: "bool", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerFreezeToken"]: + return isinstance(msg, cls) + + class MintlayerUnfreezeToken(protobuf.MessageType): + token_id: "bytes" + + def __init__( + self, + *, + token_id: "bytes", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerUnfreezeToken"]: + return isinstance(msg, cls) + + class MintlayerChangeTokenAuhtority(protobuf.MessageType): + token_id: "bytes" + destination: "str" + + def __init__( + self, + *, + token_id: "bytes", + destination: "str", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerChangeTokenAuhtority"]: + return isinstance(msg, cls) + + class MintlayerTxOutput(protobuf.MessageType): + transfer: "MintlayerTransferTxOutput | None" + lock_then_transfer: "MintlayerLockThenTransferTxOutput | None" + burn: "MintlayerBurnTxOutput | None" + create_stake_pool: "MintlayerCreateStakePoolTxOutput | None" + produce_block_from_stake: "MintlayerProduceBlockFromStakeTxOutput | None" + create_delegation_id: "MintlayerCreateDelegationIdTxOutput | None" + delegate_staking: "MintlayerDelegateStakingTxOutput | None" + issue_fungible_token: "MintlayerIssueFungibleTokenTxOutput | None" + issue_nft: "MintlayerIssueNftTxOutput | None" + data_deposit: "MintlayerDataDepositTxOutput | None" + + def __init__( + self, + *, + transfer: "MintlayerTransferTxOutput | None" = None, + lock_then_transfer: "MintlayerLockThenTransferTxOutput | None" = None, + burn: "MintlayerBurnTxOutput | None" = None, + create_stake_pool: "MintlayerCreateStakePoolTxOutput | None" = None, + produce_block_from_stake: "MintlayerProduceBlockFromStakeTxOutput | None" = None, + create_delegation_id: "MintlayerCreateDelegationIdTxOutput | None" = None, + delegate_staking: "MintlayerDelegateStakingTxOutput | None" = None, + issue_fungible_token: "MintlayerIssueFungibleTokenTxOutput | None" = None, + issue_nft: "MintlayerIssueNftTxOutput | None" = None, + data_deposit: "MintlayerDataDepositTxOutput | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerTxOutput"]: + return isinstance(msg, cls) + + class MintlayerOutputValue(protobuf.MessageType): + amount: "bytes" + token_id: "bytes | None" + + def __init__( + self, + *, + amount: "bytes", + token_id: "bytes | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerOutputValue"]: + return isinstance(msg, cls) + class MintlayerTransferTxOutput(protobuf.MessageType): address: "str | None" address_n: "list[int]" - amount: "int" + value: "MintlayerOutputValue" def __init__( self, *, - amount: "int", + value: "MintlayerOutputValue", address_n: "list[int] | None" = None, address: "str | None" = None, ) -> None: @@ -4156,6 +4376,220 @@ def __init__( def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerTransferTxOutput"]: return isinstance(msg, cls) + class MintlayerOutputTimeLock(protobuf.MessageType): + until_height: "int | None" + until_time: "int | None" + for_block_count: "int | None" + for_seconds: "int | None" + + def __init__( + self, + *, + until_height: "int | None" = None, + until_time: "int | None" = None, + for_block_count: "int | None" = None, + for_seconds: "int | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerOutputTimeLock"]: + return isinstance(msg, cls) + + class MintlayerLockThenTransferTxOutput(protobuf.MessageType): + address: "str | None" + address_n: "list[int]" + value: "MintlayerOutputValue" + lock: "MintlayerOutputTimeLock" + + def __init__( + self, + *, + value: "MintlayerOutputValue", + lock: "MintlayerOutputTimeLock", + address_n: "list[int] | None" = None, + address: "str | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerLockThenTransferTxOutput"]: + return isinstance(msg, cls) + + class MintlayerBurnTxOutput(protobuf.MessageType): + value: "MintlayerOutputValue" + + def __init__( + self, + *, + value: "MintlayerOutputValue", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerBurnTxOutput"]: + return isinstance(msg, cls) + + class MintlayerCreateStakePoolTxOutput(protobuf.MessageType): + pool_id: "bytes" + pledge: "bytes" + staker: "str" + vrf_public_key: "str" + decommission_key: "str" + margin_ratio_per_thousand: "int" + cost_per_block: "bytes" + + def __init__( + self, + *, + pool_id: "bytes", + pledge: "bytes", + staker: "str", + vrf_public_key: "str", + decommission_key: "str", + margin_ratio_per_thousand: "int", + cost_per_block: "bytes", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerCreateStakePoolTxOutput"]: + return isinstance(msg, cls) + + class MintlayerProduceBlockFromStakeTxOutput(protobuf.MessageType): + destination: "str" + pool_id: "bytes" + + def __init__( + self, + *, + destination: "str", + pool_id: "bytes", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerProduceBlockFromStakeTxOutput"]: + return isinstance(msg, cls) + + class MintlayerCreateDelegationIdTxOutput(protobuf.MessageType): + destination: "str" + pool_id: "bytes" + + def __init__( + self, + *, + destination: "str", + pool_id: "bytes", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerCreateDelegationIdTxOutput"]: + return isinstance(msg, cls) + + class MintlayerDelegateStakingTxOutput(protobuf.MessageType): + amount: "bytes" + delegation_id: "bytes" + + def __init__( + self, + *, + amount: "bytes", + delegation_id: "bytes", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerDelegateStakingTxOutput"]: + return isinstance(msg, cls) + + class MintlayerTokenTotalSupply(protobuf.MessageType): + type: "MintlayerTokenTotalSupplyType" + fixed_amount: "bytes | None" + + def __init__( + self, + *, + type: "MintlayerTokenTotalSupplyType", + fixed_amount: "bytes | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerTokenTotalSupply"]: + return isinstance(msg, cls) + + class MintlayerIssueFungibleTokenTxOutput(protobuf.MessageType): + token_ticker: "bytes" + number_of_decimals: "int" + metadata_uri: "bytes" + total_supply: "MintlayerTokenTotalSupply" + authority: "str" + is_freezable: "bool" + + def __init__( + self, + *, + token_ticker: "bytes", + number_of_decimals: "int", + metadata_uri: "bytes", + total_supply: "MintlayerTokenTotalSupply", + authority: "str", + is_freezable: "bool", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerIssueFungibleTokenTxOutput"]: + return isinstance(msg, cls) + + class MintlayerIssueNftTxOutput(protobuf.MessageType): + token_id: "bytes" + destination: "str" + creator: "str | None" + name: "bytes" + description: "bytes" + ticker: "bytes" + icon_uri: "bytes | None" + additional_metadata_uri: "bytes | None" + media_uri: "bytes | None" + media_hash: "bytes" + + def __init__( + self, + *, + token_id: "bytes", + destination: "str", + name: "bytes", + description: "bytes", + ticker: "bytes", + media_hash: "bytes", + creator: "str | None" = None, + icon_uri: "bytes | None" = None, + additional_metadata_uri: "bytes | None" = None, + media_uri: "bytes | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerIssueNftTxOutput"]: + return isinstance(msg, cls) + + class MintlayerDataDepositTxOutput(protobuf.MessageType): + data: "bytes" + + def __init__( + self, + *, + data: "bytes", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerDataDepositTxOutput"]: + return isinstance(msg, cls) + class MintlayerPrevTx(protobuf.MessageType): version: "int" inputs_count: "int" @@ -4191,12 +4625,12 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerPrevInput"]: return isinstance(msg, cls) class MintlayerPrevTransferOutput(protobuf.MessageType): - amount: "int" + value: "MintlayerOutputValue" def __init__( self, *, - amount: "int", + value: "MintlayerOutputValue", ) -> None: pass @@ -4267,12 +4701,12 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerTxRequestSerializedType"]: return isinstance(msg, cls) class MintlayerTxAckInputWrapper(protobuf.MessageType): - input: "MintlayerUtxoTxInput" + input: "MintlayerTxInput" def __init__( self, *, - input: "MintlayerUtxoTxInput", + input: "MintlayerTxInput", ) -> None: pass @@ -4281,12 +4715,12 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerTxAckInputWrapper"]: return isinstance(msg, cls) class MintlayerTxAckOutputWrapper(protobuf.MessageType): - output: "MintlayerTransferTxOutput" + output: "MintlayerTxOutput" def __init__( self, *, - output: "MintlayerTransferTxOutput", + output: "MintlayerTxOutput", ) -> None: pass diff --git a/python/src/trezorlib/messages.py b/python/src/trezorlib/messages.py index 2aec21d285..9dbd6d38fb 100644 --- a/python/src/trezorlib/messages.py +++ b/python/src/trezorlib/messages.py @@ -361,6 +361,7 @@ class AmountUnit(IntEnum): MILLIBITCOIN = 1 MICROBITCOIN = 2 SATOSHI = 3 + ML = 4 class RequestType(IntEnum): @@ -547,6 +548,17 @@ class EthereumDataType(IntEnum): STRUCT = 8 +class MintlayerUtxoType(IntEnum): + TRANSACTION = 0 + BLOCK = 1 + + +class MintlayerTokenTotalSupplyType(IntEnum): + FIXED = 0 + LOCKABLE = 1 + UNLIMITED = 2 + + class MintlayerRequestType(IntEnum): TXINPUT = 0 TXOUTPUT = 1 @@ -5377,14 +5389,17 @@ class MintlayerPublicKey(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1003 FIELDS = { 1: protobuf.Field("public_key", "bytes", repeated=False, required=True), + 2: protobuf.Field("chain_code", "bytes", repeated=False, required=True), } def __init__( self, *, public_key: "bytes", + chain_code: "bytes", ) -> None: self.public_key = public_key + self.chain_code = chain_code class MintlayerVerifySig(protobuf.MessageType): @@ -5438,45 +5453,292 @@ class MintlayerTxRequest(protobuf.MessageType): FIELDS = { 1: protobuf.Field("request_type", "MintlayerRequestType", repeated=False, required=False, default=None), 2: protobuf.Field("details", "MintlayerTxRequestDetailsType", repeated=False, required=False, default=None), - 3: protobuf.Field("serialized", "MintlayerTxRequestSerializedType", repeated=False, required=False, default=None), + 3: protobuf.Field("serialized", "MintlayerTxRequestSerializedType", repeated=True, required=False, default=None), } def __init__( self, *, + serialized: Optional[Sequence["MintlayerTxRequestSerializedType"]] = None, request_type: Optional["MintlayerRequestType"] = None, details: Optional["MintlayerTxRequestDetailsType"] = None, - serialized: Optional["MintlayerTxRequestSerializedType"] = None, ) -> None: + self.serialized: Sequence["MintlayerTxRequestSerializedType"] = serialized if serialized is not None else [] self.request_type = request_type self.details = details - self.serialized = serialized + + +class MintlayerTxInput(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("utxo", "MintlayerUtxoTxInput", repeated=False, required=False, default=None), + 2: protobuf.Field("account", "MintlayerAccountTxInput", repeated=False, required=False, default=None), + 3: protobuf.Field("account_command", "MintlayerAccountCommandTxInput", repeated=False, required=False, default=None), + } + + def __init__( + self, + *, + utxo: Optional["MintlayerUtxoTxInput"] = None, + account: Optional["MintlayerAccountTxInput"] = None, + account_command: Optional["MintlayerAccountCommandTxInput"] = None, + ) -> None: + self.utxo = utxo + self.account = account + self.account_command = account_command class MintlayerUtxoTxInput(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { 1: protobuf.Field("address_n", "uint32", repeated=True, required=False, default=None), - 2: protobuf.Field("prev_hash", "bytes", repeated=False, required=True), - 3: protobuf.Field("prev_index", "uint32", repeated=False, required=True), - 4: protobuf.Field("sequence", "uint32", repeated=False, required=False, default=4294967295), - 5: protobuf.Field("amount", "uint64", repeated=False, required=True), + 2: protobuf.Field("address", "string", repeated=False, required=True), + 3: protobuf.Field("prev_hash", "bytes", repeated=False, required=True), + 4: protobuf.Field("prev_index", "uint32", repeated=False, required=True), + 5: protobuf.Field("type", "MintlayerUtxoType", repeated=False, required=True), + 6: protobuf.Field("sequence", "uint32", repeated=False, required=False, default=4294967295), + 7: protobuf.Field("value", "MintlayerOutputValue", repeated=False, required=True), } def __init__( self, *, + address: "str", prev_hash: "bytes", prev_index: "int", - amount: "int", + type: "MintlayerUtxoType", + value: "MintlayerOutputValue", address_n: Optional[Sequence["int"]] = None, sequence: Optional["int"] = 4294967295, ) -> None: self.address_n: Sequence["int"] = address_n if address_n is not None else [] + self.address = address self.prev_hash = prev_hash self.prev_index = prev_index - self.amount = amount + self.type = type + self.value = value + self.sequence = sequence + + +class MintlayerAccountTxInput(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("address_n", "uint32", repeated=True, required=False, default=None), + 2: protobuf.Field("address", "string", repeated=False, required=True), + 3: protobuf.Field("sequence", "uint32", repeated=False, required=False, default=4294967295), + 4: protobuf.Field("value", "MintlayerOutputValue", repeated=False, required=True), + 5: protobuf.Field("nonce", "uint64", repeated=False, required=True), + 6: protobuf.Field("delegation_id", "bytes", repeated=False, required=True), + } + + def __init__( + self, + *, + address: "str", + value: "MintlayerOutputValue", + nonce: "int", + delegation_id: "bytes", + address_n: Optional[Sequence["int"]] = None, + sequence: Optional["int"] = 4294967295, + ) -> None: + self.address_n: Sequence["int"] = address_n if address_n is not None else [] + self.address = address + self.value = value + self.nonce = nonce + self.delegation_id = delegation_id + self.sequence = sequence + + +class MintlayerAccountCommandTxInput(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("address_n", "uint32", repeated=True, required=False, default=None), + 2: protobuf.Field("address", "string", repeated=False, required=True), + 3: protobuf.Field("sequence", "uint32", repeated=False, required=False, default=4294967295), + 4: protobuf.Field("nonce", "uint64", repeated=False, required=True), + 5: protobuf.Field("mint", "MintlayerMintTokens", repeated=False, required=False, default=None), + 6: protobuf.Field("unmint", "MintlayerUnmintTokens", repeated=False, required=False, default=None), + 7: protobuf.Field("lock_token_supply", "MintlayerLockTokenSupply", repeated=False, required=False, default=None), + 8: protobuf.Field("freeze_token", "MintlayerFreezeToken", repeated=False, required=False, default=None), + 9: protobuf.Field("unfreeze_token", "MintlayerUnfreezeToken", repeated=False, required=False, default=None), + 10: protobuf.Field("change_token_authority", "MintlayerChangeTokenAuhtority", repeated=False, required=False, default=None), + } + + def __init__( + self, + *, + address: "str", + nonce: "int", + address_n: Optional[Sequence["int"]] = None, + sequence: Optional["int"] = 4294967295, + mint: Optional["MintlayerMintTokens"] = None, + unmint: Optional["MintlayerUnmintTokens"] = None, + lock_token_supply: Optional["MintlayerLockTokenSupply"] = None, + freeze_token: Optional["MintlayerFreezeToken"] = None, + unfreeze_token: Optional["MintlayerUnfreezeToken"] = None, + change_token_authority: Optional["MintlayerChangeTokenAuhtority"] = None, + ) -> None: + self.address_n: Sequence["int"] = address_n if address_n is not None else [] + self.address = address + self.nonce = nonce self.sequence = sequence + self.mint = mint + self.unmint = unmint + self.lock_token_supply = lock_token_supply + self.freeze_token = freeze_token + self.unfreeze_token = unfreeze_token + self.change_token_authority = change_token_authority + + +class MintlayerMintTokens(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + 2: protobuf.Field("amount", "bytes", repeated=False, required=True), + } + + def __init__( + self, + *, + token_id: "bytes", + amount: "bytes", + ) -> None: + self.token_id = token_id + self.amount = amount + + +class MintlayerUnmintTokens(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + } + + def __init__( + self, + *, + token_id: "bytes", + ) -> None: + self.token_id = token_id + + +class MintlayerLockTokenSupply(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + } + + def __init__( + self, + *, + token_id: "bytes", + ) -> None: + self.token_id = token_id + + +class MintlayerFreezeToken(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + 2: protobuf.Field("is_token_unfreezabe", "bool", repeated=False, required=True), + } + + def __init__( + self, + *, + token_id: "bytes", + is_token_unfreezabe: "bool", + ) -> None: + self.token_id = token_id + self.is_token_unfreezabe = is_token_unfreezabe + + +class MintlayerUnfreezeToken(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + } + + def __init__( + self, + *, + token_id: "bytes", + ) -> None: + self.token_id = token_id + + +class MintlayerChangeTokenAuhtority(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + 2: protobuf.Field("destination", "string", repeated=False, required=True), + } + + def __init__( + self, + *, + token_id: "bytes", + destination: "str", + ) -> None: + self.token_id = token_id + self.destination = destination + + +class MintlayerTxOutput(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("transfer", "MintlayerTransferTxOutput", repeated=False, required=False, default=None), + 2: protobuf.Field("lock_then_transfer", "MintlayerLockThenTransferTxOutput", repeated=False, required=False, default=None), + 3: protobuf.Field("burn", "MintlayerBurnTxOutput", repeated=False, required=False, default=None), + 4: protobuf.Field("create_stake_pool", "MintlayerCreateStakePoolTxOutput", repeated=False, required=False, default=None), + 5: protobuf.Field("produce_block_from_stake", "MintlayerProduceBlockFromStakeTxOutput", repeated=False, required=False, default=None), + 6: protobuf.Field("create_delegation_id", "MintlayerCreateDelegationIdTxOutput", repeated=False, required=False, default=None), + 7: protobuf.Field("delegate_staking", "MintlayerDelegateStakingTxOutput", repeated=False, required=False, default=None), + 8: protobuf.Field("issue_fungible_token", "MintlayerIssueFungibleTokenTxOutput", repeated=False, required=False, default=None), + 9: protobuf.Field("issue_nft", "MintlayerIssueNftTxOutput", repeated=False, required=False, default=None), + 10: protobuf.Field("data_deposit", "MintlayerDataDepositTxOutput", repeated=False, required=False, default=None), + } + + def __init__( + self, + *, + transfer: Optional["MintlayerTransferTxOutput"] = None, + lock_then_transfer: Optional["MintlayerLockThenTransferTxOutput"] = None, + burn: Optional["MintlayerBurnTxOutput"] = None, + create_stake_pool: Optional["MintlayerCreateStakePoolTxOutput"] = None, + produce_block_from_stake: Optional["MintlayerProduceBlockFromStakeTxOutput"] = None, + create_delegation_id: Optional["MintlayerCreateDelegationIdTxOutput"] = None, + delegate_staking: Optional["MintlayerDelegateStakingTxOutput"] = None, + issue_fungible_token: Optional["MintlayerIssueFungibleTokenTxOutput"] = None, + issue_nft: Optional["MintlayerIssueNftTxOutput"] = None, + data_deposit: Optional["MintlayerDataDepositTxOutput"] = None, + ) -> None: + self.transfer = transfer + self.lock_then_transfer = lock_then_transfer + self.burn = burn + self.create_stake_pool = create_stake_pool + self.produce_block_from_stake = produce_block_from_stake + self.create_delegation_id = create_delegation_id + self.delegate_staking = delegate_staking + self.issue_fungible_token = issue_fungible_token + self.issue_nft = issue_nft + self.data_deposit = data_deposit + + +class MintlayerOutputValue(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("amount", "bytes", repeated=False, required=True), + 2: protobuf.Field("token_id", "bytes", repeated=False, required=False, default=None), + } + + def __init__( + self, + *, + amount: "bytes", + token_id: Optional["bytes"] = None, + ) -> None: + self.amount = amount + self.token_id = token_id class MintlayerTransferTxOutput(protobuf.MessageType): @@ -5484,21 +5746,265 @@ class MintlayerTransferTxOutput(protobuf.MessageType): FIELDS = { 1: protobuf.Field("address", "string", repeated=False, required=False, default=None), 2: protobuf.Field("address_n", "uint32", repeated=True, required=False, default=None), - 3: protobuf.Field("amount", "uint64", repeated=False, required=True), + 3: protobuf.Field("value", "MintlayerOutputValue", repeated=False, required=True), } def __init__( self, *, - amount: "int", + value: "MintlayerOutputValue", address_n: Optional[Sequence["int"]] = None, address: Optional["str"] = None, ) -> None: self.address_n: Sequence["int"] = address_n if address_n is not None else [] - self.amount = amount + self.value = value + self.address = address + + +class MintlayerOutputTimeLock(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("until_height", "uint64", repeated=False, required=False, default=None), + 2: protobuf.Field("until_time", "uint64", repeated=False, required=False, default=None), + 3: protobuf.Field("for_block_count", "uint64", repeated=False, required=False, default=None), + 4: protobuf.Field("for_seconds", "uint64", repeated=False, required=False, default=None), + } + + def __init__( + self, + *, + until_height: Optional["int"] = None, + until_time: Optional["int"] = None, + for_block_count: Optional["int"] = None, + for_seconds: Optional["int"] = None, + ) -> None: + self.until_height = until_height + self.until_time = until_time + self.for_block_count = for_block_count + self.for_seconds = for_seconds + + +class MintlayerLockThenTransferTxOutput(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("address", "string", repeated=False, required=False, default=None), + 2: protobuf.Field("address_n", "uint32", repeated=True, required=False, default=None), + 3: protobuf.Field("value", "MintlayerOutputValue", repeated=False, required=True), + 4: protobuf.Field("lock", "MintlayerOutputTimeLock", repeated=False, required=True), + } + + def __init__( + self, + *, + value: "MintlayerOutputValue", + lock: "MintlayerOutputTimeLock", + address_n: Optional[Sequence["int"]] = None, + address: Optional["str"] = None, + ) -> None: + self.address_n: Sequence["int"] = address_n if address_n is not None else [] + self.value = value + self.lock = lock self.address = address +class MintlayerBurnTxOutput(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("value", "MintlayerOutputValue", repeated=False, required=True), + } + + def __init__( + self, + *, + value: "MintlayerOutputValue", + ) -> None: + self.value = value + + +class MintlayerCreateStakePoolTxOutput(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("pool_id", "bytes", repeated=False, required=True), + 2: protobuf.Field("pledge", "bytes", repeated=False, required=True), + 3: protobuf.Field("staker", "string", repeated=False, required=True), + 4: protobuf.Field("vrf_public_key", "string", repeated=False, required=True), + 5: protobuf.Field("decommission_key", "string", repeated=False, required=True), + 6: protobuf.Field("margin_ratio_per_thousand", "uint32", repeated=False, required=True), + 7: protobuf.Field("cost_per_block", "bytes", repeated=False, required=True), + } + + def __init__( + self, + *, + pool_id: "bytes", + pledge: "bytes", + staker: "str", + vrf_public_key: "str", + decommission_key: "str", + margin_ratio_per_thousand: "int", + cost_per_block: "bytes", + ) -> None: + self.pool_id = pool_id + self.pledge = pledge + self.staker = staker + self.vrf_public_key = vrf_public_key + self.decommission_key = decommission_key + self.margin_ratio_per_thousand = margin_ratio_per_thousand + self.cost_per_block = cost_per_block + + +class MintlayerProduceBlockFromStakeTxOutput(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("destination", "string", repeated=False, required=True), + 2: protobuf.Field("pool_id", "bytes", repeated=False, required=True), + } + + def __init__( + self, + *, + destination: "str", + pool_id: "bytes", + ) -> None: + self.destination = destination + self.pool_id = pool_id + + +class MintlayerCreateDelegationIdTxOutput(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("destination", "string", repeated=False, required=True), + 2: protobuf.Field("pool_id", "bytes", repeated=False, required=True), + } + + def __init__( + self, + *, + destination: "str", + pool_id: "bytes", + ) -> None: + self.destination = destination + self.pool_id = pool_id + + +class MintlayerDelegateStakingTxOutput(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("amount", "bytes", repeated=False, required=True), + 2: protobuf.Field("delegation_id", "bytes", repeated=False, required=True), + } + + def __init__( + self, + *, + amount: "bytes", + delegation_id: "bytes", + ) -> None: + self.amount = amount + self.delegation_id = delegation_id + + +class MintlayerTokenTotalSupply(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("type", "MintlayerTokenTotalSupplyType", repeated=False, required=True), + 2: protobuf.Field("fixed_amount", "bytes", repeated=False, required=False, default=None), + } + + def __init__( + self, + *, + type: "MintlayerTokenTotalSupplyType", + fixed_amount: Optional["bytes"] = None, + ) -> None: + self.type = type + self.fixed_amount = fixed_amount + + +class MintlayerIssueFungibleTokenTxOutput(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("token_ticker", "bytes", repeated=False, required=True), + 2: protobuf.Field("number_of_decimals", "uint32", repeated=False, required=True), + 3: protobuf.Field("metadata_uri", "bytes", repeated=False, required=True), + 4: protobuf.Field("total_supply", "MintlayerTokenTotalSupply", repeated=False, required=True), + 5: protobuf.Field("authority", "string", repeated=False, required=True), + 6: protobuf.Field("is_freezable", "bool", repeated=False, required=True), + } + + def __init__( + self, + *, + token_ticker: "bytes", + number_of_decimals: "int", + metadata_uri: "bytes", + total_supply: "MintlayerTokenTotalSupply", + authority: "str", + is_freezable: "bool", + ) -> None: + self.token_ticker = token_ticker + self.number_of_decimals = number_of_decimals + self.metadata_uri = metadata_uri + self.total_supply = total_supply + self.authority = authority + self.is_freezable = is_freezable + + +class MintlayerIssueNftTxOutput(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + 2: protobuf.Field("destination", "string", repeated=False, required=True), + 3: protobuf.Field("creator", "string", repeated=False, required=False, default=None), + 4: protobuf.Field("name", "bytes", repeated=False, required=True), + 5: protobuf.Field("description", "bytes", repeated=False, required=True), + 6: protobuf.Field("ticker", "bytes", repeated=False, required=True), + 7: protobuf.Field("icon_uri", "bytes", repeated=False, required=False, default=None), + 8: protobuf.Field("additional_metadata_uri", "bytes", repeated=False, required=False, default=None), + 9: protobuf.Field("media_uri", "bytes", repeated=False, required=False, default=None), + 10: protobuf.Field("media_hash", "bytes", repeated=False, required=True), + } + + def __init__( + self, + *, + token_id: "bytes", + destination: "str", + name: "bytes", + description: "bytes", + ticker: "bytes", + media_hash: "bytes", + creator: Optional["str"] = None, + icon_uri: Optional["bytes"] = None, + additional_metadata_uri: Optional["bytes"] = None, + media_uri: Optional["bytes"] = None, + ) -> None: + self.token_id = token_id + self.destination = destination + self.name = name + self.description = description + self.ticker = ticker + self.media_hash = media_hash + self.creator = creator + self.icon_uri = icon_uri + self.additional_metadata_uri = additional_metadata_uri + self.media_uri = media_uri + + +class MintlayerDataDepositTxOutput(protobuf.MessageType): + MESSAGE_WIRE_TYPE = None + FIELDS = { + 1: protobuf.Field("data", "bytes", repeated=False, required=True), + } + + def __init__( + self, + *, + data: "bytes", + ) -> None: + self.data = data + + class MintlayerPrevTx(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { @@ -5539,15 +6045,15 @@ def __init__( class MintlayerPrevTransferOutput(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("amount", "uint64", repeated=False, required=True), + 1: protobuf.Field("value", "MintlayerOutputValue", repeated=False, required=True), } def __init__( self, *, - amount: "int", + value: "MintlayerOutputValue", ) -> None: - self.amount = amount + self.value = value class MintlayerTxAckUtxoInput(protobuf.MessageType): @@ -5618,13 +6124,13 @@ def __init__( class MintlayerTxAckInputWrapper(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 2: protobuf.Field("input", "MintlayerUtxoTxInput", repeated=False, required=True), + 2: protobuf.Field("input", "MintlayerTxInput", repeated=False, required=True), } def __init__( self, *, - input: "MintlayerUtxoTxInput", + input: "MintlayerTxInput", ) -> None: self.input = input @@ -5632,13 +6138,13 @@ def __init__( class MintlayerTxAckOutputWrapper(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 5: protobuf.Field("output", "MintlayerTransferTxOutput", repeated=False, required=True), + 5: protobuf.Field("output", "MintlayerTxOutput", repeated=False, required=True), } def __init__( self, *, - output: "MintlayerTransferTxOutput", + output: "MintlayerTxOutput", ) -> None: self.output = output diff --git a/python/src/trezorlib/mintlayer.py b/python/src/trezorlib/mintlayer.py index 140b80260f..c8e73aaab2 100644 --- a/python/src/trezorlib/mintlayer.py +++ b/python/src/trezorlib/mintlayer.py @@ -70,8 +70,8 @@ def verify_sig( return False return isinstance(resp, messages.Success) -Input = messages.MintlayerUtxoTxInput -Output = messages.MintlayerTransferTxOutput +Input = messages.MintlayerTxInput +Output = messages.MintlayerTxOutput TxHash = bytes @dataclass diff --git a/rust/trezor-client/src/client/mintlayer.rs b/rust/trezor-client/src/client/mintlayer.rs new file mode 100644 index 0000000000..a2154e7a4a --- /dev/null +++ b/rust/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, MintlayerTxAckOutput, MintlayerTxAckUtxoInput, + MintlayerTxInput, MintlayerTxOutput, + }, + Error, TrezorResponse, +}; + +/// 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, +} + +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 {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; + } + } + 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/rust/trezor-client/src/client/mod.rs b/rust/trezor-client/src/client/mod.rs index 052a2fa8ad..35aa784407 100644 --- a/rust/trezor-client/src/client/mod.rs +++ b/rust/trezor-client/src/client/mod.rs @@ -16,6 +16,9 @@ pub use solana::*; pub mod common; pub use common::*; +pub mod mintlayer; +pub use mintlayer::*; + use crate::{ error::{Error, Result}, messages::TrezorMessage, diff --git a/rust/trezor-client/src/error.rs b/rust/trezor-client/src/error.rs index 62bdac5f52..777e9bfc6e 100644 --- a/rust/trezor-client/src/error.rs +++ b/rust/trezor-client/src/error.rs @@ -92,4 +92,14 @@ pub enum 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/rust/trezor-client/src/protos/generated/messages_bitcoin.rs b/rust/trezor-client/src/protos/generated/messages_bitcoin.rs index 5d99647cc1..59422c58bb 100644 --- a/rust/trezor-client/src/protos/generated/messages_bitcoin.rs +++ b/rust/trezor-client/src/protos/generated/messages_bitcoin.rs @@ -13289,6 +13289,8 @@ 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 { @@ -13304,6 +13306,7 @@ 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 } } @@ -13314,6 +13317,7 @@ 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 } } @@ -13323,6 +13327,7 @@ impl ::protobuf::Enum for AmountUnit { AmountUnit::MILLIBITCOIN, AmountUnit::MICROBITCOIN, AmountUnit::SATOSHI, + AmountUnit::ML, ]; } @@ -13590,10 +13595,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*J\n\nAmountUnit\x12\x0b\n\x07BI\ + \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\x03B?\n#com.satoshilabs.trezor.lib.pro\ - tobufB\x14TrezorMessageBitcoin\x80\xa6\x1d\x01\ + \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 diff --git a/rust/trezor-client/src/protos/generated/messages_mintlayer.rs b/rust/trezor-client/src/protos/generated/messages_mintlayer.rs index b122b8cf61..956afae943 100644 --- a/rust/trezor-client/src/protos/generated/messages_mintlayer.rs +++ b/rust/trezor-client/src/protos/generated/messages_mintlayer.rs @@ -553,6 +553,8 @@ 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, @@ -605,14 +607,55 @@ impl MintlayerPublicKey { 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(1); + 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, @@ -628,6 +671,9 @@ impl ::protobuf::Message for MintlayerPublicKey { if self.public_key.is_none() { return false; } + if self.chain_code.is_none() { + return false; + } true } @@ -637,6 +683,9 @@ impl ::protobuf::Message for MintlayerPublicKey { 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())?; }, @@ -652,6 +701,9 @@ impl ::protobuf::Message for MintlayerPublicKey { 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 @@ -661,6 +713,9 @@ impl ::protobuf::Message for MintlayerPublicKey { 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(()) } @@ -679,12 +734,14 @@ impl ::protobuf::Message for MintlayerPublicKey { 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 @@ -1251,7 +1308,7 @@ pub struct MintlayerTxRequest { // @@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: ::protobuf::MessageField, + pub serialized: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxRequest.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -1303,7 +1360,7 @@ impl MintlayerTxRequest { |m: &MintlayerTxRequest| { &m.details }, |m: &mut MintlayerTxRequest| { &mut m.details }, )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, mintlayer_tx_request::MintlayerTxRequestSerializedType>( + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "serialized", |m: &MintlayerTxRequest| { &m.serialized }, |m: &mut MintlayerTxRequest| { &mut m.serialized }, @@ -1333,7 +1390,7 @@ impl ::protobuf::Message for MintlayerTxRequest { ::protobuf::rt::read_singular_message_into_field(is, &mut self.details)?; }, 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.serialized)?; + self.serialized.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -1354,10 +1411,10 @@ impl ::protobuf::Message for MintlayerTxRequest { 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(); + 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 @@ -1370,9 +1427,9 @@ impl ::protobuf::Message for MintlayerTxRequest { 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() { + 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(()) } @@ -1400,7 +1457,7 @@ impl ::protobuf::Message for MintlayerTxRequest { static instance: MintlayerTxRequest = MintlayerTxRequest { request_type: ::std::option::Option::None, details: ::protobuf::MessageField::none(), - serialized: ::protobuf::MessageField::none(), + serialized: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance @@ -1943,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, + // @@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, @@ -1973,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() { @@ -2009,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) @@ -2028,52 +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 uint64 amount = 5; + // optional uint32 sequence = 6; - pub fn amount(&self) -> u64 { - self.amount.unwrap_or(0) + 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: u64) { - self.amount = ::std::option::Option::Some(v); + 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 }, @@ -2084,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", @@ -2106,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 } @@ -2128,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()?); }, - 40 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); + 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())?; @@ -2154,38 +2457,5677 @@ 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); - } - if let Some(v) = self.sequence { my_size += ::protobuf::rt::uint32_size(4, v); } - if let Some(v) = self.amount { - my_size += ::protobuf::rt::uint64_size(5, v); + if let Some(v) = self.type_ { + my_size += ::protobuf::rt::int32_size(5, v.value()); } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + 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 { + 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(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<()> { - 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.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 { - os.write_uint64(5, 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(()) @@ -2199,161 +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, + // @@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; + // required bytes data = 1; - pub fn address(&self) -> &str { - match self.address.as_ref() { + pub fn data(&self) -> &[u8] { + match self.data.as_ref() { Some(v) => v, - None => "", + None => &[], } } - pub fn clear_address(&mut self) { - self.address = ::std::option::Option::None; + pub fn clear_data(&mut self) { + self.data = ::std::option::Option::None; } - pub fn has_address(&self) -> bool { - self.address.is_some() + pub fn has_data(&self) -> bool { + self.data.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); + 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_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address = ::std::option::Option::Some(::std::string::String::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.address.as_mut().unwrap() + self.data.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); + 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 }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "amount", - |m: &MintlayerTransferTxOutput| { &m.amount }, - |m: &mut MintlayerTransferTxOutput| { &mut m.amount }, + "data", + |m: &MintlayerDataDepositTxOutput| { &m.data }, + |m: &mut MintlayerDataDepositTxOutput| { &mut m.data }, )); - ::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 @@ -2363,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()?); - }, - 24 => { - self.amount = ::std::option::Option::Some(is.read_uint64()?); + 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())?; @@ -2386,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 { - my_size += ::protobuf::rt::uint64_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); @@ -2401,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 { - os.write_uint64(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(()) @@ -2422,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; } @@ -2890,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, + // @@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, @@ -2908,32 +8802,13 @@ impl MintlayerPrevTransferOutput { ::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); - } - 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", @@ -2947,17 +8822,22 @@ 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 } 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()?); + 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())?; @@ -2971,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 { - my_size += ::protobuf::rt::uint64_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); @@ -2980,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 { - os.write_uint64(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(()) @@ -3000,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 @@ -3168,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, @@ -3188,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 }, @@ -3433,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, @@ -3453,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 }, @@ -3560,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\ @@ -3567,52 +9577,157 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \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\"3\n\x12MintlayerP\ - ublicKey\x12\x1d\n\npublic_key\x18\x01\x20\x02(\x0cR\tpublicKey\"i\n\x12\ - MintlayerVerifySig\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ - \x12\x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07mess\ - age\x18\x03\x20\x02(\x0cR\x07message\"\xb6\x01\n\x0fMintlayerSignTx\x12#\ - \n\routputs_count\x18\x01\x20\x02(\rR\x0coutputsCount\x12!\n\x0cinputs_c\ - ount\x18\x02\x20\x02(\rR\x0binputsCount\x12\x1b\n\x07version\x18\x03\x20\ - \x01(\r:\x011R\x07version\x12\"\n\tserialize\x18\x04\x20\x01(\x08:\x04tr\ - ueR\tserialize\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.MintlayerRequestT\ - ypeR\x0brequestType\x12h\n\x07details\x18\x02\x20\x01(\x0b2N.hw.trezor.m\ - essages.mintlayer.MintlayerTxRequest.MintlayerTxRequestDetailsTypeR\x07d\ - etails\x12q\n\nserialized\x18\x03\x20\x01(\x0b2Q.hw.trezor.messages.mint\ - layer.MintlayerTxRequest.MintlayerTxRequestSerializedTypeR\nserialized\ - \x1a]\n\x1dMintlayerTxRequestDetailsType\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\x0fs\ - ignature_index\x18\x01\x20\x01(\rR\x0esignatureIndex\x12\x1c\n\tsignatur\ - e\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\ - \nTXFINISHED\x10\x03\"\xaf\x01\n\x14MintlayerUtxoTxInput\x12\x1b\n\taddr\ - ess_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\tprevIn\ - dex\x12&\n\x08sequence\x18\x04\x20\x01(\r:\n4294967295R\x08sequence\x12\ - \x16\n\x06amount\x18\x05\x20\x02(\x04R\x06amount\"j\n\x19MintlayerTransf\ - erTxOutput\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\"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\x0coutputsC\ - ount\"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\x1bM\ - intlayerPrevTransferOutput\x12\x16\n\x06amount\x18\x01\x20\x02(\x04R\x06\ - amount\"\xe3\x01\n\x17MintlayerTxAckUtxoInput\x12`\n\x02tx\x18\x01\x20\ - \x02(\x0b2P.hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.Mintlay\ - erTxAckInputWrapperR\x02tx\x1af\n\x1aMintlayerTxAckInputWrapper\x12H\n\ - \x05input\x18\x02\x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerU\ - txoTxInputR\x05input\"\xe6\x01\n\x14MintlayerTxAckOutput\x12^\n\x02tx\ + \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\"\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\x1an\n\x1bMintlayerTxAckOutputWrapp\ - er\x12O\n\x06output\x18\x05\x20\x02(\x0b27.hw.trezor.messages.mintlayer.\ - MintlayerTransferTxOutputR\x06outputB=\n#com.satoshilabs.trezor.lib.prot\ - obufB\x16TrezorMessageMintlayer\ + 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 @@ -3630,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()); @@ -3638,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()); @@ -3649,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(),