From 650a2d569b86acc52bc107da7acc7f9f93e9114a Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Mon, 28 Oct 2024 23:36:18 +0100 Subject: [PATCH] Mintlayer proto changes - fix comments - remove unused messages - change all ID types to bech32 encoding --- common/protob/messages-mintlayer.proto | 199 +-- .../modtrezormintlayer/modtrezormintlayer.c | 49 +- .../modtrezormintlayer/modtrezormintlayer.h | 234 +-- core/embed/rust/mintlayer.h | 2 +- core/embed/rust/src/mintlayer/mod.rs | 830 ++++------ core/mocks/generated/trezormintlayer.pyi | 4 +- core/src/apps/mintlayer/sign_tx/helpers.py | 17 +- core/src/apps/mintlayer/sign_tx/layout.py | 32 +- core/src/apps/mintlayer/sign_tx/signer.py | 161 +- core/src/trezor/crypto/bech32.py | 59 +- core/src/trezor/messages.py | 126 +- python/src/trezorlib/messages.py | 136 +- .../protos/generated/messages_mintlayer.rs | 1422 +++++------------ 13 files changed, 1017 insertions(+), 2254 deletions(-) diff --git a/common/protob/messages-mintlayer.proto b/common/protob/messages-mintlayer.proto index e741954b4..37ff950ca 100644 --- a/common/protob/messages-mintlayer.proto +++ b/common/protob/messages-mintlayer.proto @@ -5,14 +5,6 @@ package hw.trezor.messages.mintlayer; option java_package = "com.satoshilabs.trezor.lib.protobuf"; option java_outer_classname = "TrezorMessageMintlayer"; -/** XXX - -Most likely, ALL fields in this file should be `required`. We are leaving some optionals -in place, in cases where the field value continues to the JSON as a string -- on the off -chance that somebody is relying on the behavior. - -*/ - /** * Request: Ask the device for a Mintlayer address. * @start @@ -60,8 +52,8 @@ message MintlayerPublicKey { */ message MintlayerSignMessage { 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 - required bytes message = 3; // message to verify + required string address = 2; // destination address in bech32 encoding + required bytes message = 3; // message to sign } /** @@ -74,8 +66,8 @@ message MintlayerSignTx { required uint32 outputs_count = 1; // number of transaction outputs required uint32 inputs_count = 2; // number of transaction inputs optional uint32 version = 3 [default=1]; // transaction version - optional bool serialize = 4 [default=true]; // serialize the full transaction, as opposed to only outputting the signatures - optional bool chunkify = 5; // display the address in chunks of 4 characters + optional bool serialize = 4 [default=true]; // serialize the full transaction, as opposed to only outputting the signatures + optional bool chunkify = 5; // display the address in chunks of 4 characters } /** @@ -139,7 +131,7 @@ message MintlayerTxInput { } /** -* Type of information required by transaction signing process +* Enum for UTXO type used by MintlayerUtxoTxInput */ enum MintlayerUtxoType { TRANSACTION = 0; @@ -154,40 +146,39 @@ message MintlayerAddressPath { optional uint32 multisig_idx = 2; // in case of a multisig the key index } -/** Data type for transaction input to be signed. +/** Data type for transaction UTXO input to be signed. * * @embed */ message MintlayerUtxoTxInput { repeated MintlayerAddressPath 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 + required string address = 2; // destination address in bech32 encoding 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; // source type of the utxo (Transaction or BlockReward) optional uint32 sequence = 6 [default=0xffffffff]; // sequence - required MintlayerOutputValue value = 7; // amount of previous transaction output } -/** Data type for transaction input to be signed. +/** Data type for transaction Account input to be signed. * * @embed */ message MintlayerAccountTxInput { repeated MintlayerAddressPath 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 + required string address = 2; // destination address in bech32 encoding 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 + required string delegation_id = 6; // the delegation id of the account in bech32 encoding } -/** Data type for transaction input to be signed. +/** Data type for transaction Account Command input to be signed. * * @embed */ message MintlayerAccountCommandTxInput { repeated MintlayerAddressPath 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 + required string address = 2; // destination address in bech32 encoding optional uint32 sequence = 3 [default=0xffffffff]; // sequence required uint64 nonce = 4; // incrementing account nonce optional MintlayerMintTokens mint = 5; // mint tokens @@ -201,72 +192,72 @@ message MintlayerAccountCommandTxInput { optional MintlayerChangeTokenMetadataUri change_token_metadata_uri = 13; // change token metadata uri } -/** Data type for account command +/** Data type for account command Mint tokens * @embed */ message MintlayerMintTokens { - required bytes token_id = 1; // token id + required string token_id = 1; // token id in bech32 encoding required bytes amount = 2; // amoun of tokens to mint } -/** Data type for account command +/** Data type for account command Unmint tokens * @embed */ message MintlayerUnmintTokens { - required bytes token_id = 1; // token id + required string token_id = 1; // token id in bech32 encoding } -/** Data type for account command +/** Data type for account command Lock token supply * @embed */ message MintlayerLockTokenSupply { - required bytes token_id = 1; // token id + required string token_id = 1; // token id in bech32 encoding } -/** Data type for account command +/** Data type for account command Freeze token * @embed */ message MintlayerFreezeToken { - required bytes token_id = 1; // token id + required string token_id = 1; // token id in bech32 encoding required bool is_token_unfreezabe = 2; // is unfreezeable after freezing it } -/** Data type for account command +/** Data type for account command Unfreeze token * @embed */ message MintlayerUnfreezeToken { - required bytes token_id = 1; // token id + required string token_id = 1; // token id in bech32 encoding } -/** Data type for account command +/** Data type for account command Change token authority * @embed */ message MintlayerChangeTokenAuhtority { - required bytes token_id = 1; // token id - required string destination = 2; // destination for the new authority + required string token_id = 1; // token id in bech32 encoding + required string destination = 2; // destination for the new authority in bech32 encoding } -/** Data type for account command +/** Data type for account command Conclude order * @embed */ message MintlayerConcludeOrder { - required bytes order_id = 1; // order id + required string order_id = 1; // order id in bech32 encoding } -/** Data type for account command +/** Data type for account command Fill order * @embed */ message MintlayerFillOrder { - required bytes order_id = 1; // order id + required string order_id = 1; // order id in bech32 encoding required bytes amount = 2; // value - required string destination = 3; // the destination + required string destination = 3; // the destination in bech32 encoding } -/** Data type for account command +/** Data type for account command Change token metadata uri * @embed */ message MintlayerChangeTokenMetadataUri { - required bytes token_id = 1; // token id + required string token_id = 1; // token id in bech32 encoding required bytes metadata_uri = 2; // new metadata uri } @@ -285,14 +276,14 @@ message MintlayerTxOutput { optional MintlayerIssueNftTxOutput issue_nft = 9; // issue NFT output optional MintlayerDataDepositTxOutput data_deposit = 10; // data deposit output optional MintlayerHtlcTxOutput htlc = 11; // HTLC output - optional MintlayerAnyoneCanTakeTxOutput anyone_can_take = 12; // Anyone can take output + optional MintlayerCreateOrderTxOutput create_order = 12; // Create order output } /** Data type for output value information for the token * @embed */ message MintlayerTokenOutputValue { - required bytes token_id = 1; // token id + required string token_id = 1; // token id in bech32 encoding required bytes token_ticker = 2; // the token ticker required uint32 number_of_decimals = 3; // the number of decimals for the token } @@ -305,11 +296,11 @@ message MintlayerOutputValue { optional MintlayerTokenOutputValue token = 2; // optional token info } -/** Data type for transaction output to be signed. +/** Data type for transaction Transfer output to be signed. * @embed */ message MintlayerTransferTxOutput { - required string address = 1; // destination address in Base58 encoding; script_type must be PAYTOADDRESS + required string address = 1; // destination address in bech32 encoding required MintlayerOutputValue value = 2; // amount to spend in atoms for coin or token } @@ -323,61 +314,61 @@ message MintlayerOutputTimeLock { optional uint64 for_seconds = 4; // lock for number of seconds } -/** Data type for transaction output to be signed. +/** Data type for transaction Lock then transfer output to be signed. * @embed */ message MintlayerLockThenTransferTxOutput { - optional string address = 1; // destination address in Base58 encoding; script_type must be PAYTOADDRESS + required string address = 1; // destination address in bech32 encoding required MintlayerOutputValue value = 2; // amount to spend in atoms required MintlayerOutputTimeLock lock = 3; // output lock } -/** Data type for transaction output to be signed. +/** Data type for transaction Burn output to be signed. * @embed */ message MintlayerBurnTxOutput { required MintlayerOutputValue value = 1; // amount to burn in atoms } -/** Data type for transaction output to be signed. +/** Data type for transaction Create stake pool 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 + required string pool_id = 1; // the pool id in bech32 encoding + required bytes pledge = 2; // the pledge amount + required string staker = 3; // the staker destination address in bech32 encoding + required string vrf_public_key = 4; // the VRF public key address in bech32 encoding + required string decommission_key = 5; // the decommission key in bech32 encoding + 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. +/** Data type for transaction Produce block from stake output to be signed. * @embed */ message MintlayerProduceBlockFromStakeTxOutput { - required string destination = 1; // the staker destination address - required bytes pool_id = 2; // the pool id + required string destination = 1; // the staker destination address in bech32 encoding + required string pool_id = 2; // the pool id in bech32 encoding } -/** Data type for transaction output to be signed. +/** Data type for transaction Create delegation id output to be signed. * @embed */ message MintlayerCreateDelegationIdTxOutput { - required string destination = 1; // the delegation owner destination address - required bytes pool_id = 2; // the pool id + required string destination = 1; // the delegation owner destination address in bech32 encoding + required string pool_id = 2; // the pool id in bech32 encoding } -/** Data type for transaction output to be signed. +/** Data type for transaction Delegate staking output to be signed. * @embed */ message MintlayerDelegateStakingTxOutput { - required bytes amount = 1; // the amount to stake - required bytes delegation_id = 2; // the delegation id + required bytes amount = 1; // the amount to delegate + required string delegation_id = 2; // the delegation id in bech32 encoding } /** -* Type of information required by transaction signing process +* Enum for Token total supply used by MintlayerTokenTotalSupply */ enum MintlayerTokenTotalSupplyType { FIXED = 0; @@ -385,33 +376,33 @@ enum MintlayerTokenTotalSupplyType { UNLIMITED = 2; } -/** Data type for transaction output to be signed. +/** Data type for Total token supply * @embed */ message MintlayerTokenTotalSupply { - required MintlayerTokenTotalSupplyType type = 1; // the amount to stake - optional bytes fixed_amount = 2; // the amount to stake + required MintlayerTokenTotalSupplyType type = 1; // the type of total token supply + optional bytes fixed_amount = 2; // optional amount in case of fixed total token supply } -/** Data type for transaction output to be signed. +/** Data type for transaction Issue fungible token 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 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 string authority = 5; // the token authority destination address in bech32 encoding required bool is_freezable = 6; // if the token freezable or not } -/** Data type for transaction output to be signed. +/** Data type for transaction Issue NFT 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 string token_id = 1; // the token id in bech32 encoding + required string destination = 2; // the NFT authority destination address in bech32 encoding + optional string creator = 3; // the NFT creator destination address in bech32 encoding required bytes name = 4; // the NFT name required bytes description = 5; // the NFT description required bytes ticker = 6; // the NFT ticker @@ -421,91 +412,55 @@ message MintlayerIssueNftTxOutput { required bytes media_hash = 10; // the NFT media hash } -/** Data type for transaction output to be signed. +/** Data type for transaction Data deposit output to be signed. * @embed */ message MintlayerDataDepositTxOutput { required bytes data = 1; // the data to be deposited } -/** Data type for transaction output to be signed. +/** Data type for transaction HTLC output to be signed. * @embed */ message MintlayerHtlcTxOutput { required MintlayerOutputValue value = 1; // amount to transfer required bytes secret_hash = 2; // the hash of the exchanged secret - required string spend_key = 3; // the key that can spend the HTLC given the secret + required string spend_key = 3; // the key that can spend the HTLC given the secret in bech32 encoding required MintlayerOutputTimeLock refund_timelock = 4; // time lock - required string refund_key = 5; // the key for a refund after the time lock has expired + required string refund_key = 5; // the key for a refund after the time lock has expired in bech32 encoding } /** Data type for transaction output to be signed. * @embed */ -message MintlayerAnyoneCanTakeTxOutput { - required string conclude_key = 1; // The key that can authorize conclusion of an order +message MintlayerCreateOrderTxOutput { + required string conclude_key = 1; // The key that can authorize conclusion of an order in bech32 encoding required MintlayerOutputValue ask = 2; // ask value of the order required MintlayerOutputValue give = 3; // give value of the order } -/** Data type for metadata about previous transaction which contains the UTXO being spent. - * @embed - */ -message MintlayerPrevTx { - required uint32 version = 1; - required uint32 inputs_count = 6; - required uint32 outputs_count = 7; -} - -/** Data type for inputs of previous transactions. - * - * When adding fields, take care to not conflict with TxInput - * @embed - */ -message MintlayerPrevInput { - 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 - - // fields that are in use, or have been in the past, in MintlayerUtxoTxInput - reserved 1, 4, 5; -} - -/** Data type for outputs of previous transactions. - * @embed - */ -message MintlayerPrevTransferOutput { - required MintlayerOutputValue value = 1; // amount sent to this output -} - /** * Request: Data about input to be signed. * - * Do not edit this type without considering compatibility with TxAck. - * Prefer to modify the inner TxInput type. - * - * @next TxRequest + * @next MintlayerTxRequest */ message MintlayerTxAckUtxoInput { required MintlayerTxAckInputWrapper tx = 1; message MintlayerTxAckInputWrapper { - required MintlayerTxInput input = 2; + required MintlayerTxInput input = 1; } } /** * Request: Data about output to be signed. - * Wire-alias of TxAck. * - * Do not edit this type without considering compatibility with TxAck. - * Prefer to modify the inner TxOutput type. - * - * @next TxRequest + * @next MintlayerTxRequest */ message MintlayerTxAckOutput { required MintlayerTxAckOutputWrapper tx = 1; message MintlayerTxAckOutputWrapper { - required MintlayerTxOutput output = 5; + required MintlayerTxOutput output = 1; } } diff --git a/core/embed/extmod/modtrezormintlayer/modtrezormintlayer.c b/core/embed/extmod/modtrezormintlayer/modtrezormintlayer.c index 0c7c45e54..b2a5f1565 100644 --- a/core/embed/extmod/modtrezormintlayer/modtrezormintlayer.c +++ b/core/embed/extmod/modtrezormintlayer/modtrezormintlayer.c @@ -29,6 +29,51 @@ #include "modtrezormintlayer.h" +void handle_err(ByteArray *res) { + if (res->data != NULL) { + return; + } + + switch (res->len_or_err.err) { + case WrongHashSize: + mp_raise_ValueError("Invalid hash size"); + break; + case InvalidUtxoType: + mp_raise_ValueError("Invalid UTXO type"); + break; + case InvalidAmount: + mp_raise_ValueError("Invalid amount"); + break; + case InvalidAccountCommand: + mp_raise_ValueError("Invalid account command"); + break; + case InvalidDestination: + mp_raise_ValueError("Invalid destination"); + break; + case InvalidIsTokenUnfreezable: + mp_raise_ValueError("Invalid token unfreezable flag"); + break; + case InvalidIsTokenFreezable: + mp_raise_ValueError("Invalid token freezable flag"); + break; + case InvalidVrfPublicKey: + mp_raise_ValueError("Invalid VRF public key"); + break; + case InvalidPublicKey: + mp_raise_ValueError("Invalid public key"); + break; + case InvalidOutputTimeLock: + mp_raise_ValueError("Invalid output time lock"); + break; + case InvalidTokenTotalSupply: + mp_raise_ValueError("Invalid token total supply"); + break; + default: + mp_raise_ValueError("Unknown error"); + break; + } +} + STATIC const mp_rom_map_elem_t mod_trezormintlayer_globals_table[] = { {MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_trezormintlayer)}, {MP_ROM_QSTR(MP_QSTR_encode_utxo_input), @@ -76,9 +121,9 @@ STATIC const mp_rom_map_elem_t mod_trezormintlayer_globals_table[] = { &mod_trezormintlayer_utils_mintlayer_encode_data_deposit_output_obj)}, {MP_ROM_QSTR(MP_QSTR_encode_htlc_output), MP_ROM_PTR(&mod_trezormintlayer_utils_mintlayer_encode_htlc_output_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_anyone_can_take_output), + {MP_ROM_QSTR(MP_QSTR_encode_create_order_output), MP_ROM_PTR( - &mod_trezormintlayer_utils_mintlayer_encode_anyone_can_take_output_obj)}, + &mod_trezormintlayer_utils_mintlayer_encode_create_order_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/extmod/modtrezormintlayer/modtrezormintlayer.h b/core/embed/extmod/modtrezormintlayer/modtrezormintlayer.h index 6a35297e4..0e6bfe3d4 100644 --- a/core/embed/extmod/modtrezormintlayer/modtrezormintlayer.h +++ b/core/embed/extmod/modtrezormintlayer/modtrezormintlayer.h @@ -10,50 +10,7 @@ #include "curves.h" #include "memzero.h" -void handle_err(ByteArray *res) { - if (res->data != NULL) { - return; - } - - switch (res->len_or_err.err) { - case WrongHashSize: - mp_raise_ValueError("Invalid hash size"); - break; - case InvalidUtxoType: - mp_raise_ValueError("Invalid UTXO type"); - break; - case InvalidAmount: - mp_raise_ValueError("Invalid amount"); - break; - case InvalidAccountCommand: - mp_raise_ValueError("Invalid account command"); - break; - case InvalidDestination: - mp_raise_ValueError("Invalid destination"); - break; - case InvalidIsTokenUnfreezable: - mp_raise_ValueError("Invalid token unfreezable flag"); - break; - case InvalidIsTokenFreezable: - mp_raise_ValueError("Invalid token freezable flag"); - break; - case InvalidVrfPublicKey: - mp_raise_ValueError("Invalid VRF public key"); - break; - case InvalidPublicKey: - mp_raise_ValueError("Invalid public key"); - break; - case InvalidOutputTimeLock: - mp_raise_ValueError("Invalid output time lock"); - break; - case InvalidTokenTotalSupply: - mp_raise_ValueError("Invalid token total supply"); - break; - default: - mp_raise_ValueError("Unknown error"); - break; - } -} +void handle_err(ByteArray *res); /// def encode_utxo_input(tx_hash: bytes, index: int, utxo_type: int) -> bytes: /// """ @@ -63,24 +20,13 @@ STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_utxo_input( 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) { - printf("invalid hash len: %ld", (long int)hash.len); - mp_raise_ValueError("Invalid hash"); - } uint32_t idx = trezor_obj_get_uint(index); uint32_t utxo_type = trezor_obj_get_uint(utxo_type_obj); ByteArray arr = mintlayer_encode_utxo_input(hash.buf, hash.len, idx, utxo_type); handle_err(&arr); - vstr_t pkh = {0}; - vstr_init_len(&pkh, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)pkh.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &pkh); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_3( @@ -99,11 +45,6 @@ mod_trezormintlayer_utils_mintlayer_encode_account_spending_input( 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); @@ -111,14 +52,7 @@ mod_trezormintlayer_utils_mintlayer_encode_account_spending_input( nonce, hash.buf, hash.len, amount.buf, amount.len); handle_err(&arr); - vstr_t pkh = {0}; - vstr_init_len(&pkh, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)pkh.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &pkh); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_3( @@ -139,11 +73,6 @@ mod_trezormintlayer_utils_mintlayer_encode_token_account_command_input( 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); @@ -151,14 +80,7 @@ mod_trezormintlayer_utils_mintlayer_encode_token_account_command_input( nonce, command, hash.buf, hash.len, data.buf, data.len); handle_err(&arr); - vstr_t pkh = {0}; - vstr_init_len(&pkh, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)pkh.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &pkh); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( @@ -182,14 +104,7 @@ mod_trezormintlayer_utils_mintlayer_encode_conclude_order_account_command_input( nonce, order_id.buf, order_id.len); handle_err(&arr); - vstr_t pkh = {0}; - vstr_init_len(&pkh, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)pkh.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &pkh); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_2( @@ -219,14 +134,7 @@ mod_trezormintlayer_utils_mintlayer_encode_fill_order_account_command_input( destination.buf, destination.len); handle_err(&arr); - vstr_t pkh = {0}; - vstr_init_len(&pkh, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)pkh.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &pkh); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( @@ -252,14 +160,7 @@ STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_transfer_output( token_id.len, address.buf, address.len); handle_err(&arr); - vstr_t encoding = {0}; - vstr_init_len(&encoding, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_3( @@ -288,14 +189,7 @@ mod_trezormintlayer_utils_mintlayer_encode_lock_then_transfer_output( lock_amount, address.buf, address.len); handle_err(&arr); - vstr_t encoding = {0}; - vstr_init_len(&encoding, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( @@ -317,14 +211,7 @@ STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_burn_output( token_id.buf, token_id.len); handle_err(&arr); - vstr_t encoding = {0}; - vstr_init_len(&encoding, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_2( @@ -361,14 +248,7 @@ mod_trezormintlayer_utils_mintlayer_encode_create_stake_pool_output( cost_per_block.buf, cost_per_block.len); handle_err(&arr); - vstr_t encoding = {0}; - vstr_init_len(&encoding, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( @@ -391,14 +271,7 @@ mod_trezormintlayer_utils_mintlayer_encode_produce_from_stake_output( destination.buf, destination.len, pool_id.buf, pool_id.len); handle_err(&arr); - vstr_t encoding = {0}; - vstr_init_len(&encoding, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_2( @@ -421,14 +294,7 @@ mod_trezormintlayer_utils_mintlayer_encode_create_delegation_id_output( destination.buf, destination.len, pool_id.buf, pool_id.len); handle_err(&arr); - vstr_t encoding = {0}; - vstr_init_len(&encoding, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_2( @@ -451,14 +317,7 @@ mod_trezormintlayer_utils_mintlayer_encode_delegate_staking_output( amount.buf, amount.len, delegation_id.buf, delegation_id.len); handle_err(&arr); - vstr_t encoding = {0}; - vstr_init_len(&encoding, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_2( @@ -492,14 +351,7 @@ mod_trezormintlayer_utils_mintlayer_encode_issue_fungible_token_output( authority.buf, authority.len, is_freezable); handle_err(&arr); - vstr_t encoding = {0}; - vstr_init_len(&encoding, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( @@ -545,14 +397,7 @@ STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_issue_nft_output( destination.buf, destination.len); handle_err(&arr); - vstr_t encoding = {0}; - vstr_init_len(&encoding, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( @@ -572,14 +417,7 @@ STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_data_deposit_output( mintlayer_encode_data_deposit_output(deposit.buf, deposit.len); handle_err(&arr); - vstr_t encoding = {0}; - vstr_init_len(&encoding, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_1( @@ -612,28 +450,20 @@ STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_htlc_output( secret_hash.buf, secret_hash.len); handle_err(&arr); - vstr_t encoding = {0}; - vstr_init_len(&encoding, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( mod_trezormintlayer_utils_mintlayer_encode_htlc_output_obj, 7, 7, mod_trezormintlayer_utils_mintlayer_encode_htlc_output); -/// def encode_anyone_can_take_output(destination: bytes, ask_amount: bytes, +/// def encode_create_order_output(destination: bytes, ask_amount: bytes, /// ask_token_id: bytes, give_amount: bytes, give_token_id: bytes) -> bytes: /// """ -/// encodes an anyone can take output with given the conclude key, give and +/// encodes a create order output with given the conclude key, give and /// take amounts /// """ -STATIC mp_obj_t -mod_trezormintlayer_utils_mintlayer_encode_anyone_can_take_output( +STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_create_order_output( size_t n_args, const mp_obj_t *args) { mp_buffer_info_t conclude_key = {0}; mp_get_buffer_raise(args[0], &conclude_key, MP_BUFFER_READ); @@ -646,25 +476,18 @@ mod_trezormintlayer_utils_mintlayer_encode_anyone_can_take_output( mp_buffer_info_t give_token_id = {0}; mp_get_buffer_raise(args[4], &give_token_id, MP_BUFFER_READ); - ByteArray arr = mintlayer_encode_anyone_can_take_output( + ByteArray arr = mintlayer_encode_create_order_output( conclude_key.buf, conclude_key.len, ask_amount.buf, ask_amount.len, ask_token_id.buf, ask_token_id.len, give_amount.buf, give_amount.len, give_token_id.buf, give_token_id.len); handle_err(&arr); - vstr_t encoding = {0}; - vstr_init_len(&encoding, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( - mod_trezormintlayer_utils_mintlayer_encode_anyone_can_take_output_obj, 5, 5, - mod_trezormintlayer_utils_mintlayer_encode_anyone_can_take_output); + mod_trezormintlayer_utils_mintlayer_encode_create_order_output_obj, 5, 5, + mod_trezormintlayer_utils_mintlayer_encode_create_order_output); /// def encode_compact_length(length: int) -> bytes: /// """ @@ -676,14 +499,7 @@ mod_trezormintlayer_utils_mintlayer_encode_comact_length(mp_obj_t length) { ByteArray arr = mintlayer_encode_compact_length(len); handle_err(&arr); - vstr_t encoding = {0}; - vstr_init_len(&encoding, arr.len_or_err.len); - int i = 0; - for (; i < arr.len_or_err.len; i++) { - ((uint8_t *)encoding.buf)[i] = (uint8_t)arr.data[i]; - } - - return mp_obj_new_str_from_vstr(&mp_type_bytes, &encoding); + return mp_obj_new_bytes(arr.data, arr.len_or_err.len); } STATIC MP_DEFINE_CONST_FUN_OBJ_1( diff --git a/core/embed/rust/mintlayer.h b/core/embed/rust/mintlayer.h index dcf5e0975..ed020f2a8 100644 --- a/core/embed/rust/mintlayer.h +++ b/core/embed/rust/mintlayer.h @@ -122,7 +122,7 @@ ByteArray mintlayer_encode_htlc_output( const unsigned char* spend_key_data, uint32_t spend_key_data_len, const unsigned char* secret_hash_data, uint32_t secret_hash_data_len); -ByteArray mintlayer_encode_anyone_can_take_output( +ByteArray mintlayer_encode_create_order_output( const unsigned char* conclude_key_data, uint32_t conclude_key_data_len, const unsigned char* ask_coin_amount_data, uint32_t ask_coin_amount_data_len, const unsigned char* ask_token_id_data, diff --git a/core/embed/rust/src/mintlayer/mod.rs b/core/embed/rust/src/mintlayer/mod.rs index a0a48d322..a0dea3600 100644 --- a/core/embed/rust/src/mintlayer/mod.rs +++ b/core/embed/rust/src/mintlayer/mod.rs @@ -1,15 +1,11 @@ use crate::micropython::ffi; use core::{ alloc::{GlobalAlloc, Layout}, - num::ParseIntError, ptr::null_mut, - str::FromStr, }; use parity_scale_codec::{Decode, DecodeAll, Encode}; -const TEN: UnsignedIntType = 10; - #[repr(C)] #[derive(Eq, PartialEq, Clone, Copy)] pub enum MintlayerErrorCode { @@ -55,31 +51,27 @@ extern "C" fn mintlayer_encode_utxo_input( utxo_type: u32, ) -> ByteArray { let hash = unsafe { core::slice::from_raw_parts(data, data_len as usize) }; - let hash = H256(match hash.try_into() { - Ok(hash) => hash, - Err(_) => return MintlayerErrorCode::WrongHashSize.into(), - }); + let res = mintlayer_encode_utxo_input_impl(hash, utxo_type, index); + handle_err_or_encode(res) +} +fn mintlayer_encode_utxo_input_impl( + hash: &[u8], + utxo_type: u32, + index: u32, +) -> Result { + let hash = H256( + hash.try_into() + .map_err(|_| MintlayerErrorCode::WrongHashSize)?, + ); let outpoint = match utxo_type { 0 => OutPointSourceId::Transaction(hash), 1 => OutPointSourceId::BlockReward(hash), - _ => return MintlayerErrorCode::InvalidUtxoType.into(), + _ => return Err(MintlayerErrorCode::InvalidUtxoType), }; 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 - 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_or_err: LenOrError { len }, - } + Ok(tx_input) } #[no_mangle] @@ -92,34 +84,29 @@ extern "C" fn mintlayer_encode_account_spending_input( ) -> ByteArray { let delegation_id = unsafe { core::slice::from_raw_parts(delegation_id_data, delegation_id_data_len as usize) }; - let delegation_id = H256(match delegation_id.try_into() { - Ok(hash) => hash, - Err(_) => return MintlayerErrorCode::WrongHashSize.into(), - }); - let coin_amount = unsafe { core::slice::from_raw_parts(amount_data, amount_data_len as usize) }; - let amount = match Amount::from_bytes_be(coin_amount.as_ref()) { - Some(amount) => amount, - None => return MintlayerErrorCode::InvalidAmount.into(), - }; + let res = mintlayer_encode_account_spending_input_impl(delegation_id, coin_amount, nonce); + handle_err_or_encode(res) +} + +fn mintlayer_encode_account_spending_input_impl( + delegation_id: &[u8], + coin_amount: &[u8], + nonce: u64, +) -> Result { + let delegation_id = H256( + delegation_id + .try_into() + .map_err(|_| MintlayerErrorCode::WrongHashSize)?, + ); + let amount = + Amount::from_bytes_be(coin_amount.as_ref()).ok_or(MintlayerErrorCode::InvalidAmount)?; 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_or_err: LenOrError { len }, - } + Ok(tx_input) } #[no_mangle] @@ -133,55 +120,46 @@ extern "C" fn mintlayer_encode_token_account_command_input( ) -> ByteArray { let token_id = unsafe { core::slice::from_raw_parts(token_id_data, token_id_data_len as usize) }; + let data = unsafe { core::slice::from_raw_parts(data, data_len as usize) }; + + let res = mintlayer_encode_token_account_command_input_impl(token_id, command, data, nonce); + handle_err_or_encode(res) +} + +fn mintlayer_encode_token_account_command_input_impl( + token_id: &[u8], + command: u32, + data: &[u8], + nonce: u64, +) -> Result { let token_id = H256(match token_id.try_into() { Ok(hash) => hash, - Err(_) => return MintlayerErrorCode::WrongHashSize.into(), + Err(_) => return Err(MintlayerErrorCode::WrongHashSize), }); - - let data = unsafe { core::slice::from_raw_parts(data, data_len as usize) }; let account_command = match command { 0 => { - let amount = match Amount::from_bytes_be(data.as_ref()) { - Some(amount) => amount, - None => return MintlayerErrorCode::InvalidAmount.into(), - }; + let amount = + Amount::from_bytes_be(data.as_ref()).ok_or(MintlayerErrorCode::InvalidAmount)?; AccountCommand::MintTokens(token_id, amount) } 1 => AccountCommand::UnmintTokens(token_id), 2 => AccountCommand::LockTokenSupply(token_id), 3 => { - let is_token_unfreezabe = match IsTokenUnfreezable::decode_all(&mut data.as_ref()) { - Ok(res) => res, - Err(_) => return MintlayerErrorCode::InvalidIsTokenUnfreezable.into(), - }; + let is_token_unfreezabe = IsTokenUnfreezable::decode_all(&mut data.as_ref()) + .map_err(|_| MintlayerErrorCode::InvalidIsTokenUnfreezable)?; AccountCommand::FreezeToken(token_id, is_token_unfreezabe) } 4 => AccountCommand::UnfreezeToken(token_id), 5 => { - let destination = match Destination::decode_all(&mut data.as_ref()) { - Ok(destination) => destination, - Err(_) => return MintlayerErrorCode::InvalidDestination.into(), - }; + let destination = Destination::decode_all(&mut data.as_ref()) + .map_err(|_| MintlayerErrorCode::InvalidDestination)?; AccountCommand::ChangeTokenAuthority(token_id, destination) } 8 => AccountCommand::ChangeTokenMetadataUri(token_id, data.to_vec()), - _ => return MintlayerErrorCode::InvalidAccountCommand.into(), + _ => return Err(MintlayerErrorCode::InvalidAccountCommand), }; - 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_or_err: LenOrError { len }, - } + Ok(tx_input) } #[no_mangle] @@ -199,19 +177,8 @@ extern "C" fn mintlayer_encode_conclude_order_account_command_input( let account_command = AccountCommand::ConcludeOrder(order_id); 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_or_err: LenOrError { len }, - } + encode_to_byte_array(&tx_input) } #[no_mangle] @@ -226,38 +193,39 @@ extern "C" fn mintlayer_encode_fill_order_account_command_input( ) -> ByteArray { let order_id = unsafe { core::slice::from_raw_parts(order_id_data, order_id_data_len as usize) }; - let order_id = H256(match order_id.try_into() { - Ok(hash) => hash, - Err(_) => return MintlayerErrorCode::WrongHashSize.into(), - }); let coin_amount = unsafe { core::slice::from_raw_parts(amount_data, amount_data_len as usize) }; - let amount = match Amount::from_bytes_be(coin_amount.as_ref()) { - Some(amount) => amount, - None => return MintlayerErrorCode::InvalidAmount.into(), - }; - let destination_bytes = unsafe { core::slice::from_raw_parts(destination_data, destination_data_len as usize) }; - let destination = match Destination::decode_all(&mut destination_bytes.as_ref()) { - Ok(destination) => destination, - Err(_) => return MintlayerErrorCode::InvalidDestination.into(), - }; - let account_command = AccountCommand::FillOrder(order_id, amount, destination); - 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; + let res = mintlayer_encode_fill_order_account_command_input_impl( + order_id, + coin_amount, + destination_bytes, + nonce, + ); - // Prevent Rust from freeing the memory associated with vec_data - core::mem::forget(vec_data); + handle_err_or_encode(res) +} - // Construct and return the ByteArray struct - ByteArray { - data: ptr_data, - len_or_err: LenOrError { len }, - } +fn mintlayer_encode_fill_order_account_command_input_impl( + order_id: &[u8], + coin_amount: &[u8], + destination_bytes: &[u8], + nonce: u64, +) -> Result { + let order_id = H256( + order_id + .try_into() + .map_err(|_| MintlayerErrorCode::WrongHashSize)?, + ); + let amount = + Amount::from_bytes_be(coin_amount.as_ref()).ok_or(MintlayerErrorCode::InvalidAmount)?; + + let destination = Destination::decode_all(&mut destination_bytes.as_ref()) + .map_err(|_| MintlayerErrorCode::InvalidDestination)?; + let account_command = AccountCommand::FillOrder(order_id, amount, destination); + let tx_input = TxInput::AccountCommand(nonce, account_command); + Ok(tx_input) } fn parse_output_value( @@ -313,19 +281,7 @@ extern "C" fn mintlayer_encode_transfer_output( 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_or_err: LenOrError { len }, - } + encode_to_byte_array(&txo) } #[no_mangle] @@ -366,19 +322,7 @@ extern "C" fn mintlayer_encode_lock_then_transfer_output( 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_or_err: LenOrError { len }, - } + encode_to_byte_array(&txo) } #[no_mangle] @@ -400,19 +344,7 @@ extern "C" fn mintlayer_encode_burn_output( 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_or_err: LenOrError { len }, - } + encode_to_byte_array(&txo) } #[no_mangle] @@ -432,57 +364,67 @@ extern "C" fn mintlayer_encode_create_stake_pool_output( 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(match pool_id.try_into() { - Ok(hash) => hash, - Err(_) => return MintlayerErrorCode::WrongHashSize.into(), - }); - let coin_amount = + let pledge_coin_amount = unsafe { core::slice::from_raw_parts(pledge_amount_data, pledge_amount_data_len as usize) }; - let pledge = match Amount::from_bytes_be(coin_amount.as_ref()) { - Some(amount) => amount, - None => return MintlayerErrorCode::InvalidAmount.into(), - }; - - let destination_bytes = unsafe { + let staker_destination_bytes = unsafe { core::slice::from_raw_parts( staker_destination_data, staker_destination_data_len as usize, ) }; - let staker = match Destination::decode_all(&mut destination_bytes.as_ref()) { - Ok(destination) => destination, - Err(_) => return MintlayerErrorCode::InvalidDestination.into(), - }; - 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 = match VRFPublicKeyHolder::decode_all(&mut vrf_public_key.as_ref()) { - Ok(res) => res, - Err(_) => return MintlayerErrorCode::InvalidVrfPublicKey.into(), - }; - - let destination_bytes = unsafe { + let decommission_destination_bytes = unsafe { core::slice::from_raw_parts( decommission_destination_data, decommission_destination_data_len as usize, ) }; - let decommission_key = match Destination::decode_all(&mut destination_bytes.as_ref()) { - Ok(destination) => destination, - Err(_) => return MintlayerErrorCode::InvalidDestination.into(), - }; - let coin_amount = unsafe { + let cost_per_block_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 = match Amount::from_bytes_be(coin_amount.as_ref()) { - Some(amount) => amount, - None => return MintlayerErrorCode::InvalidAmount.into(), - }; + let res = mintlayer_encode_create_stake_pool_output_impl( + pool_id, + pledge_coin_amount, + staker_destination_bytes, + vrf_public_key, + decommission_destination_bytes, + cost_per_block_coin_amount, + margin_ratio_per_thousand, + ); + + handle_err_or_encode(res) +} + +fn mintlayer_encode_create_stake_pool_output_impl( + pool_id: &[u8], + pledge_coin_amount: &[u8], + staker_destination_bytes: &[u8], + vrf_public_key: &[u8], + decommission_destination_bytes: &[u8], + cost_per_block_coin_amount: &[u8], + margin_ratio_per_thousand: u16, +) -> Result { + let pool_id = H256( + pool_id + .try_into() + .map_err(|_| MintlayerErrorCode::WrongHashSize)?, + ); + let pledge = Amount::from_bytes_be(pledge_coin_amount.as_ref()) + .ok_or(MintlayerErrorCode::InvalidAmount)?; + let staker = Destination::decode_all(&mut staker_destination_bytes.as_ref()) + .map_err(|_| MintlayerErrorCode::InvalidDestination)?; + let vrf_public_key = VRFPublicKeyHolder::decode_all(&mut vrf_public_key.as_ref()) + .map_err(|_| MintlayerErrorCode::InvalidVrfPublicKey)?; + let decommission_key = Destination::decode_all(&mut decommission_destination_bytes.as_ref()) + .map_err(|_| MintlayerErrorCode::InvalidDestination)?; + let cost_per_block = Amount::from_bytes_be(cost_per_block_coin_amount.as_ref()) + .ok_or(MintlayerErrorCode::InvalidAmount)?; let txo = TxOutput::CreateStakePool( pool_id, StakePoolData { @@ -494,20 +436,7 @@ extern "C" fn mintlayer_encode_create_stake_pool_output( cost_per_block, }, ); - - 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_or_err: LenOrError { len }, - } + Ok(txo) } #[no_mangle] @@ -532,19 +461,7 @@ extern "C" fn mintlayer_encode_produce_from_stake_output( 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_or_err: LenOrError { len }, - } + encode_to_byte_array(&txo) } #[no_mangle] @@ -569,19 +486,7 @@ extern "C" fn mintlayer_encode_create_delegation_id_output( 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_or_err: LenOrError { len }, - } + encode_to_byte_array(&txo) } #[no_mangle] @@ -606,19 +511,7 @@ extern "C" fn mintlayer_encode_delegate_staking_output( 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_or_err: LenOrError { len }, - } + encode_to_byte_array(&txo) } #[no_mangle] @@ -637,41 +530,54 @@ extern "C" fn mintlayer_encode_issue_fungible_token_output( ) -> 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 = match Destination::decode_all(&mut authority_bytes.as_ref()) { - Ok(destination) => destination, - Err(_) => return MintlayerErrorCode::InvalidDestination.into(), - }; + let coin_amount = + unsafe { core::slice::from_raw_parts(fixed_amount_data, fixed_amount_data_len as usize) }; + let res = mintlayer_encode_issue_fungible_token_output_impl( + token_ticker, + metadata_uri, + authority_bytes, + is_freezable, + total_supply_type, + coin_amount, + number_of_decimals, + ); + + handle_err_or_encode(res) +} + +fn mintlayer_encode_issue_fungible_token_output_impl( + token_ticker: &[u8], + metadata_uri: &[u8], + authority_bytes: &[u8], + is_freezable: u8, + total_supply_type: u32, + coin_amount: &[u8], + number_of_decimals: u8, +) -> Result { + let token_ticker = token_ticker.to_vec(); + let metadata_uri = metadata_uri.to_vec(); + let authority = Destination::decode_all(&mut authority_bytes.as_ref()) + .map_err(|_| MintlayerErrorCode::InvalidDestination)?; let is_freezable = match is_freezable { 0 => IsTokenFreezable::No, 1 => IsTokenFreezable::Yes, - _ => return MintlayerErrorCode::InvalidIsTokenFreezable.into(), + _ => return Err(MintlayerErrorCode::InvalidIsTokenFreezable), }; - 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 = match Amount::from_bytes_be(coin_amount.as_ref()) { - Some(amount) => amount, - None => return MintlayerErrorCode::InvalidAmount.into(), - }; + let amount = Amount::from_bytes_be(coin_amount.as_ref()) + .ok_or(MintlayerErrorCode::InvalidAmount)?; TokenTotalSupply::Fixed(amount) } 1 => TokenTotalSupply::Lockable, 2 => TokenTotalSupply::Unlimited, - _ => return MintlayerErrorCode::InvalidTokenTotalSupply.into(), + _ => return Err(MintlayerErrorCode::InvalidTokenTotalSupply), }; - let issuance = TokenIssuance::V1(TokenIssuanceV1 { token_ticker, number_of_decimals, @@ -680,22 +586,8 @@ extern "C" fn mintlayer_encode_issue_fungible_token_output( 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_or_err: LenOrError { len }, - } + Ok(txo) } #[no_mangle] @@ -723,61 +615,79 @@ extern "C" fn mintlayer_encode_issue_nft_output( ) -> ByteArray { let token_id = unsafe { core::slice::from_raw_parts(token_id_data, token_id_data_len as usize) }; - let token_id = H256(match token_id.try_into() { - Ok(hash) => hash, - Err(_) => return MintlayerErrorCode::WrongHashSize.into(), - }); - 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( - match creator.try_into() { - Ok(res) => res, - Err(_) => return MintlayerErrorCode::InvalidPublicKey.into(), - }, - ))) - }; - 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 = match Destination::decode_all(&mut destination_bytes.as_ref()) { - Ok(destination) => destination, - Err(_) => return MintlayerErrorCode::InvalidDestination.into(), - }; + let res = mintlayer_encode_issue_nft_output_impl( + token_id, + creator_data_len, + creator, + name, + description, + ticker, + icon_uri, + additional_metadata_uri, + media_uri, + media_hash, + destination_bytes, + ); + + handle_err_or_encode(res) +} + +fn mintlayer_encode_issue_nft_output_impl( + token_id: &[u8], + creator_data_len: u32, + creator: &[u8], + name: &[u8], + description: &[u8], + ticker: &[u8], + icon_uri: &[u8], + additional_metadata_uri: &[u8], + media_uri: &[u8], + media_hash: &[u8], + destination_bytes: &[u8], +) -> Result { + let token_id = H256( + token_id + .try_into() + .map_err(|_| MintlayerErrorCode::WrongHashSize)?, + ); + let creator = if creator_data_len == 0 { + None + } else { + Some(PublicKeyHolder::Secp256k1Schnorr(PublicKey( + creator + .try_into() + .map_err(|_| MintlayerErrorCode::InvalidPublicKey)?, + ))) + }; + let name = name.to_vec(); + let description = description.to_vec(); + let ticker = ticker.to_vec(); + let icon_uri = icon_uri.to_vec(); + let additional_metadata_uri = additional_metadata_uri.to_vec(); + let media_uri = media_uri.to_vec(); + let media_hash = media_hash.to_vec(); + let destination = Destination::decode_all(&mut destination_bytes.as_ref()) + .map_err(|_| MintlayerErrorCode::InvalidDestination)?; let issuance = NftIssuance::V0(NftIssuanceV0 { metadata: Metadata { creator, @@ -790,22 +700,8 @@ extern "C" fn mintlayer_encode_issue_nft_output( 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_or_err: LenOrError { len }, - } + Ok(txo) } #[no_mangle] @@ -818,19 +714,7 @@ extern "C" fn mintlayer_encode_data_deposit_output( 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_or_err: LenOrError { len }, - } + encode_to_byte_array(&txo) } #[no_mangle] @@ -864,33 +748,47 @@ extern "C" fn mintlayer_encode_htlc_output( refund_destination_data_len as usize, ) }; - let refund_key = match Destination::decode_all(&mut refund_destination_bytes.as_ref()) { - Ok(destination) => destination, - Err(_) => return MintlayerErrorCode::InvalidDestination.into(), - }; let spend_destination_bytes = unsafe { core::slice::from_raw_parts(spend_destination_data, spend_destination_data_len as usize) }; - let spend_key = match Destination::decode_all(&mut spend_destination_bytes.as_ref()) { - Ok(destination) => destination, - Err(_) => return MintlayerErrorCode::InvalidDestination.into(), - }; - let hash = unsafe { core::slice::from_raw_parts(secret_hash_data, secret_hash_data_len as usize) }; - let secret_hash = HtlcSecretHash(match hash.try_into() { - Ok(hash) => hash, - Err(_) => return MintlayerErrorCode::WrongHashSize.into(), - }); + let res = mintlayer_encode_htlc_output_impl( + refund_destination_bytes, + spend_destination_bytes, + hash, + lock_type, + lock_amount, + value, + ); + + handle_err_or_encode(res) +} + +fn mintlayer_encode_htlc_output_impl( + refund_destination_bytes: &[u8], + spend_destination_bytes: &[u8], + hash: &[u8], + lock_type: u8, + lock_amount: u64, + value: OutputValue, +) -> Result { + let refund_key = Destination::decode_all(&mut refund_destination_bytes.as_ref()) + .map_err(|_| MintlayerErrorCode::InvalidDestination)?; + let spend_key = Destination::decode_all(&mut spend_destination_bytes.as_ref()) + .map_err(|_| MintlayerErrorCode::InvalidDestination)?; + let secret_hash = HtlcSecretHash( + hash.try_into() + .map_err(|_| MintlayerErrorCode::WrongHashSize)?, + ); let refund_timelock = match lock_type { 0 => OutputTimeLock::UntilHeight(lock_amount), 1 => OutputTimeLock::UntilTime(lock_amount), 2 => OutputTimeLock::ForBlockCount(lock_amount), 3 => OutputTimeLock::ForSeconds(lock_amount), - _ => return MintlayerErrorCode::InvalidOutputTimeLock.into(), + _ => return Err(MintlayerErrorCode::InvalidOutputTimeLock), }; - let txo = TxOutput::Htlc( value, HashedTimelockContract { @@ -900,24 +798,11 @@ extern "C" fn mintlayer_encode_htlc_output( refund_key, }, ); - - 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_or_err: LenOrError { len }, - } + Ok(txo) } #[no_mangle] -extern "C" fn mintlayer_encode_anyone_can_take_output( +extern "C" fn mintlayer_encode_create_order_output( destination_data: *const u8, destination_data_len: u32, ask_amount_data: *const u8, @@ -956,25 +841,13 @@ extern "C" fn mintlayer_encode_anyone_can_take_output( Err(_) => return MintlayerErrorCode::InvalidDestination.into(), }; - let txo = TxOutput::AnyoneCanTake(OrderData { + let txo = TxOutput::CreateOrder(OrderData { conclude_key: destination, ask: ask_value, give: give_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_or_err: LenOrError { len }, - } + encode_to_byte_array(&txo) } #[derive(Encode, Debug, PartialEq, Eq)] @@ -985,19 +858,8 @@ struct CompactLength { #[no_mangle] extern "C" fn mintlayer_encode_compact_length(length: u32) -> ByteArray { - let vec_data = CompactLength { value: length }.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_or_err: LenOrError { len }, - } + let len = CompactLength { value: length }; + encode_to_byte_array(&len) } struct CustomAllocator; @@ -1036,21 +898,6 @@ impl SigHashType { const MASK_OUT: u8 = 0x7f; const MASK_IN: u8 = 0x80; - // pub fn inputs_mode(&self) -> InputsMode { - // match self.0 & Self::MASK_IN { - // Self::ANYONECANPAY => InputsMode::AnyoneCanPay, - // _ => InputsMode::CommitWhoPays, - // } - // } - - // pub fn outputs_mode(&self) -> OutputsMode { - // match self.0 & Self::MASK_OUT { - // Self::NONE => OutputsMode::None, - // Self::SINGLE => OutputsMode::Single, - // _ => OutputsMode::All, - // } - // } - pub fn get(&self) -> u8 { self.0 } @@ -1082,139 +929,6 @@ impl Amount { .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::() - .ok()? - .to_amount(decimals) - } -} - -#[derive(Clone, Copy, Debug)] -struct DecimalAmount { - mantissa: UnsignedIntType, - decimals: u8, -} - -impl DecimalAmount { - pub const ZERO: Self = Self::from_uint_integral(0); - - /// Convert from integer with no decimals - pub const fn from_uint_integral(number: u128) -> Self { - Self::from_uint_decimal(number, 0) - } - - /// Convert from integer, interpreting the last N digits as the fractional - /// part - pub const fn from_uint_decimal(mantissa: UnsignedIntType, decimals: u8) -> Self { - Self { mantissa, decimals } - } - - /// Convert from amount, keeping all decimal digits - pub const fn from_amount_full_padding(amount: Amount, decimals: u8) -> Self { - Self::from_uint_decimal(amount.into_atoms(), decimals) - } - - /// Convert from amount, keeping as few decimal digits as possible (without - /// losing precision) - pub const fn from_amount_no_padding(amount: Amount, decimals: u8) -> Self { - Self::from_amount_full_padding(amount, decimals).without_padding() - } - - /// Convert to amount using given number of decimals - pub fn to_amount(self, decimals: u8) -> Option { - Some(Amount::from_atoms(self.with_decimals(decimals)?.mantissa)) - } - - /// Change the number of decimals. Can only increase decimals, otherwise we - /// risk losing digits. - pub fn with_decimals(self, decimals: u8) -> Option { - let extra_decimals = decimals.checked_sub(self.decimals)?; - let mantissa = self - .mantissa - .checked_mul(TEN.checked_pow(extra_decimals as u32)?)?; - Some(Self::from_uint_decimal(mantissa, decimals)) - } - - /// Trim trailing zeroes in the fractional part - pub const fn without_padding(mut self) -> Self { - while self.decimals > 0 && self.mantissa % TEN == 0 { - self.mantissa /= TEN; - self.decimals -= 1; - } - self - } - - /// Check this is the same number presented with the same precision - pub fn is_same(&self, other: &Self) -> bool { - (self.mantissa, self.decimals) == (other.mantissa, other.decimals) - } -} - -fn empty_to_zero(s: &str) -> &str { - match s { - "" => "0", - s => s, - } -} - -#[derive(/* thiserror::Error, */ Debug, PartialEq, Eq)] -enum ParseError { - // #[error("Resulting number is too big")] - OutOfRange, - - // #[error("The number string is too long")] - StringTooLong, - - // #[error("Empty input")] - EmptyString, - - // #[error("Invalid character used in number")] - IllegalChar, - - // #[error("Number does not contain any digits")] - NoDigits, - // #[error(transparent)] - IntParse(ParseIntError), -} - -impl FromStr for DecimalAmount { - type Err = ParseError; - - fn from_str(s: &str) -> Result { - // ensure!(s.len() <= 100, ParseError::StringTooLong); - - let s = s.trim_matches(' '); - let s = s.replace('_', ""); - // ensure!(!s.is_empty(), ParseError::EmptyString); - - let (int_str, frac_str) = s.split_once('.').unwrap_or((&s, "")); - - // 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); - - let int: UnsignedIntType = empty_to_zero(int_str) - .parse() - .map_err(ParseError::IntParse)?; - let frac: UnsignedIntType = empty_to_zero(frac_str) - .parse() - .map_err(ParseError::IntParse)?; - - let decimals: u8 = frac_str - .len() - .try_into() - .expect("Checked string length above"); - - let mantissa = TEN - .checked_pow(decimals as u32) - .and_then(|mul| int.checked_mul(mul)) - .and_then(|shifted| shifted.checked_add(frac)) - .ok_or(ParseError::OutOfRange)?; - - Ok(Self::from_uint_decimal(mantissa, decimals)) - } } #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)] @@ -1392,7 +1106,7 @@ enum TxOutput { #[codec(index = 10)] Htlc(OutputValue, HashedTimelockContract), #[codec(index = 11)] - AnyoneCanTake(OrderData), + CreateOrder(OrderData), } #[derive(Encode)] @@ -1420,15 +1134,6 @@ enum OutPointSourceId { BlockReward(H256), } -impl OutPointSourceId { - pub fn get_tx_id(&self) -> Option<&H256> { - match self { - OutPointSourceId::Transaction(id) => Some(id), - _ => None, - } - } -} - #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode, Ord, PartialOrd)] struct UtxoOutPoint { id: OutPointSourceId, @@ -1518,16 +1223,25 @@ enum TxInput { AccountCommand(#[codec(compact)] u64, AccountCommand), } -// fn signature_hash( -// mode: SigHashType, -// tx: &Transaction, -// inputs_utxos: &[Option<&TxOutput>], -// input_num: usize, -// ) -> Result { -// let mut stream = DefaultHashAlgoStream::new(); +fn handle_err_or_encode(x: Result) -> ByteArray { + match x { + Ok(value) => encode_to_byte_array(&value), + Err(value) => value.into(), + } +} -// stream_signature_hash(tx, inputs_utxos, &mut stream, mode, input_num)?; +fn encode_to_byte_array(x: &T) -> ByteArray { + let vec_data = x.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); -// let result = stream.finalize().into(); -// Ok(result) -// } + // Construct and return the ByteArray struct + ByteArray { + data: ptr_data, + len_or_err: LenOrError { len }, + } +} diff --git a/core/mocks/generated/trezormintlayer.pyi b/core/mocks/generated/trezormintlayer.pyi index cea526d01..0763fbb49 100644 --- a/core/mocks/generated/trezormintlayer.pyi +++ b/core/mocks/generated/trezormintlayer.pyi @@ -138,10 +138,10 @@ bytes) -> bytes: # extmod/modtrezormintlayer/modtrezormintlayer.h -def encode_anyone_can_take_output(destination: bytes, ask_amount: bytes, +def encode_create_order_output(destination: bytes, ask_amount: bytes, ask_token_id: bytes, give_amount: bytes, give_token_id: bytes) -> bytes: """ - encodes an anyone can take output with given the conclude key, give and + encodes a create order output with given the conclude key, give and take amounts """ diff --git a/core/src/apps/mintlayer/sign_tx/helpers.py b/core/src/apps/mintlayer/sign_tx/helpers.py index 9404916b6..30542561f 100644 --- a/core/src/apps/mintlayer/sign_tx/helpers.py +++ b/core/src/apps/mintlayer/sign_tx/helpers.py @@ -38,19 +38,16 @@ class UiConfirmOutput(UiConfirm): def __init__( self, output: MintlayerTxOutput, - coin: CoinInfo, output_index: int, chunkify: bool, ): self.output = output - self.coin = coin self.output_index = output_index self.chunkify = chunkify def confirm_dialog(self) -> Awaitable[Any]: return layout.confirm_output( self.output, - self.coin, self.output_index, self.chunkify, ) @@ -61,20 +58,14 @@ def __init__( self, spending: int, fee: int, - fee_rate: float, - coin: CoinInfo, ): self.spending = spending self.fee = fee - self.fee_rate = fee_rate - self.coin = coin def confirm_dialog(self) -> Awaitable[Any]: return layout.confirm_total( self.spending, self.fee, - self.fee_rate, - self.coin, ) @@ -107,19 +98,19 @@ def confirm_dialog(self) -> Awaitable[Any]: def confirm_output( - output: MintlayerTxOutput, coin: CoinInfo, output_index: int, chunkify: bool + output: MintlayerTxOutput, output_index: int, chunkify: bool ) -> Awaitable[None]: # type: ignore [awaitable-return-type] return ( yield UiConfirmOutput( # type: ignore [awaitable-return-type] - output, coin, output_index, chunkify + output, output_index, chunkify ) ) def confirm_total( - spending: int, fee: int, fee_rate: float, coin: CoinInfo + spending: int, fee: int ) -> Awaitable[None]: # type: ignore [awaitable-return-type] - return (yield UiConfirmTotal(spending, fee, fee_rate, coin)) # type: ignore [awaitable-return-type] + return (yield UiConfirmTotal(spending, fee)) # type: ignore [awaitable-return-type] def confirm_change_count_over_threshold(change_count: int) -> Awaitable[Any]: # type: ignore [awaitable-return-type] diff --git a/core/src/apps/mintlayer/sign_tx/layout.py b/core/src/apps/mintlayer/sign_tx/layout.py index 505f3bef6..aa2cde9fc 100644 --- a/core/src/apps/mintlayer/sign_tx/layout.py +++ b/core/src/apps/mintlayer/sign_tx/layout.py @@ -1,14 +1,13 @@ from typing import TYPE_CHECKING from trezor import TR -from trezor.crypto.bech32 import Encoding, bech32_encode, convertbits from trezor.enums import ButtonRequestType, MintlayerTokenTotalSupplyType from trezor.strings import format_amount from trezor.ui import layouts from apps.common.paths import address_n_to_str -from ...bitcoin.common import BIP32_WALLET_DEPTH, format_fee_rate +from ...bitcoin.common import BIP32_WALLET_DEPTH from ...bitcoin.keychain import address_n_to_name if TYPE_CHECKING: @@ -22,8 +21,6 @@ from apps.common.paths import Bip32Path ML_COIN = "ML" -POOL_HRP = "mpool" -DELEGATION_HRP = "mdeleg" def format_coin_amount(amount: bytes, token: MintlayerTokenOutputValue | None) -> str: @@ -64,7 +61,6 @@ def lock_to_string(lock: MintlayerOutputTimeLock) -> str: async def confirm_output( output: MintlayerTxOutput, - coin: CoinInfo, output_index: int, chunkify: bool, ) -> None: @@ -92,9 +88,7 @@ async def confirm_output( elif output.create_stake_pool: x = output.create_stake_pool assert x.staker is not None and x.decommission_key is not None - data = convertbits(x.pool_id, 8, 5) - pool_id_address = bech32_encode(POOL_HRP, data, Encoding.BECH32M) - address_short = f"""Pool ID: {pool_id_address} + address_short = f"""Pool ID: {x.pool_id} staker: {x.staker} decommission_key: {x.decommission_key}" VFT public key: {x.vrf_public_key} @@ -110,19 +104,12 @@ async def confirm_output( address_label = "Produce block from stake" elif output.create_delegation_id: x = output.create_delegation_id - assert x.destination is not None amount = "" - # FIXME: extract those 2 into 1 helper function - data = convertbits(x.pool_id, 8, 5) - pool_id_address = bech32_encode(POOL_HRP, data, Encoding.BECH32M) - address_short = f"Address: {x.destination}\nPoolId: {pool_id_address}" + address_short = f"Address: {x.destination}\nPoolId: {x.pool_id}" address_label = "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(DELEGATION_HRP, data, Encoding.BECH32M) - address_short = address + address_short = x.delegation_id amount = format_coin_amount(x.amount, None) address_label = "Delegation staking" elif output.issue_fungible_token: @@ -185,15 +172,15 @@ async def confirm_output( Refund Time Lock: {lock}""" amount = format_coin_amount(x.value.amount, x.value.token) address_label = "HTLC" - elif output.anyone_can_take: - x = output.anyone_can_take + elif output.create_order: + x = output.create_order ask_amount = format_coin_amount(x.ask.amount, x.ask.token) give_amount = format_coin_amount(x.give.amount, x.give.token) address_short = f"""Conclude Key: {x.conclude_key} Ask: {ask_amount} Give: {give_amount}""" amount = "" - address_label = "Anyone can take" + address_label = "Create Order" else: raise Exception("unhandled output type") @@ -221,14 +208,11 @@ async def confirm_output( async def confirm_total( spending: int, fee: int, - fee_rate: float, - coin: CoinInfo, ) -> 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, + fee_rate_amount=None, ) diff --git a/core/src/apps/mintlayer/sign_tx/signer.py b/core/src/apps/mintlayer/sign_tx/signer.py index 96bbe169d..99bf863ac 100644 --- a/core/src/apps/mintlayer/sign_tx/signer.py +++ b/core/src/apps/mintlayer/sign_tx/signer.py @@ -3,7 +3,7 @@ from trezor import log, workflow from trezor.crypto import mintlayer_utils -from trezor.crypto.bech32 import mintlayer_decode_address_to_bytes +from trezor.crypto.bech32 import mintlayer_decode from trezor.crypto.curve import bip340 from trezor.crypto.hashlib import blake2b from trezor.messages import ( @@ -15,8 +15,6 @@ ) from trezor.utils import empty_bytearray -from apps.common.coininfo import by_name - from . import helpers from .progress import progress @@ -35,6 +33,13 @@ _SERIALIZED_TX_BUFFER = empty_bytearray(_MAX_SERIALIZED_CHUNK_SIZE) +def decode_nullable_address(address: str | None) -> bytes: + if address is None: + return bytes() + + return mintlayer_decode(address) + + class TxUtxoInput: def __init__( self, @@ -90,13 +95,9 @@ async def signer(self) -> None: output_totals = await self.step2_approve_outputs() fee = input_totals[ML_COIN] - output_totals[ML_COIN] - fee_rate = 0 - coin = by_name("Bitcoin") await helpers.confirm_total( output_totals[ML_COIN], fee, - fee_rate, - coin, ) # Make sure proper progress is shown, in case dialog was not required @@ -109,35 +110,29 @@ async def signer(self) -> None: # This is set to True again after workflow is finished in start_default(). workflow.autolock_interrupts_workflow = False - # Verify the transaction input amounts by requesting each previous transaction - # and checking its output amount. Verify external inputs which have already - # been signed or which come with a proof of non-ownership. - await self.step3_verify_inputs() - # Check that inputs are unchanged. Serialize inputs and sign the non-segwit ones. - encoded_inputs, encoded_input_utxos = await self.step4_serialize_inputs() + encoded_inputs, encoded_input_utxos = await self.step3_serialize_inputs() if __debug__: log.debug(__name__, "encoded inputs: %s", str(encoded_inputs)) log.debug(__name__, "encoded utxos: %s", str(encoded_input_utxos)) # Serialize outputs. - encoded_outputs = await self.step5_serialize_outputs() + encoded_outputs = await self.step4_serialize_outputs() if __debug__: log.debug(__name__, "encoded outputs: %s", str(encoded_outputs)) # Sign segwit inputs and serialize witness data. - signatures = await self.step6_sign_inputs( + signatures = await self.step5_sign_inputs( encoded_inputs, encoded_input_utxos, encoded_outputs ) # Write footer and send remaining data. - await self.step7_finish(signatures) + await self.step6_finish(signatures) def __init__( self, tx: MintlayerSignTx, keychain: Keychain, - # approver: approvers.Approver | None, ) -> None: from trezor.messages import MintlayerTxRequest, MintlayerTxRequestDetailsType @@ -146,8 +141,6 @@ def __init__( self.tx_info = TxInfo(tx=tx, inputs=[], outputs=[]) self.keychain = keychain - # self.approver = approvers.BasicApprover(tx, coin) - # set of indices of inputs which are external self.external: set[int] = set() @@ -161,6 +154,7 @@ def __init__( _SERIALIZED_TX_BUFFER[:] = bytes() self.serialized_tx = _SERIALIZED_TX_BUFFER self.serialize = tx.serialize + self.chunkify = tx.chunkify or False self.tx_req = MintlayerTxRequest() self.tx_req.details = MintlayerTxRequestDetailsType() self.tx_req.serialized = [] @@ -178,7 +172,6 @@ def __init__( async def step1_process_inputs(self) -> Dict[str, int]: tx_info = self.tx_info # local_cache_attribute - # h_presigned_inputs_check = HashWriter(sha256()) totals = {} for i in range(tx_info.tx.inputs_count): @@ -193,20 +186,24 @@ async def step1_process_inputs(self) -> Dict[str, int]: ) node = [] for address in txi.utxo.address_n: - node.append(( - self.keychain.derive(address.address_n), - address.multisig_idx, - )) + node.append( + ( + self.keychain.derive(address.address_n), + address.multisig_idx, + ) + ) update_totals(totals, txo) self.tx_info.add_input(txi, txo, node) elif txi.account: node = [] for address in txi.account.address_n: - node.append(( - self.keychain.derive(address.address_n), - address.multisig_idx, - )) + node.append( + ( + self.keychain.derive(address.address_n), + address.multisig_idx, + ) + ) value = txi.account.value amount = int.from_bytes(value.amount, "big") token_or_coin = ( @@ -222,10 +219,12 @@ async def step1_process_inputs(self) -> Dict[str, int]: elif txi.account_command: node = [] for address in txi.account_command.address_n: - node.append(( - self.keychain.derive(address.address_n), - address.multisig_idx, - )) + node.append( + ( + self.keychain.derive(address.address_n), + address.multisig_idx, + ) + ) self.tx_info.add_input(txi, None, node) else: raise Exception("Unhandled tx input type") @@ -236,19 +235,14 @@ async def step2_approve_outputs(self) -> Dict[str, int]: totals = {} 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") - await helpers.confirm_output(txo, coin, i, False) + await helpers.confirm_output(txo, i, self.chunkify) update_totals(totals, txo) self.tx_info.add_output(txo) return totals - async def step3_verify_inputs(self) -> None: - return - - async def step4_serialize_inputs(self) -> Tuple[List[bytes], List[bytes]]: + async def step3_serialize_inputs(self) -> Tuple[List[bytes], List[bytes]]: encoded_inputs = [] encoded_input_utxos = [] for inp in self.tx_info.inputs: @@ -259,14 +253,15 @@ async def step4_serialize_inputs(self) -> Tuple[List[bytes], List[bytes]]: u.prev_hash, u.prev_index, int(u.type) ) encoded_inputs.append(encoded_inp) - data = mintlayer_decode_address_to_bytes(u.address) + data = decode_nullable_address(u.address) encoded_inp_utxo = self.serialize_output(inp.utxo) encoded_input_utxos.append(b"\x01" + encoded_inp_utxo) elif inp.input.account: a = inp.input.account + delegation_id = mintlayer_decode(a.delegation_id) encoded_inp = mintlayer_utils.encode_account_spending_input( - a.nonce, a.delegation_id, a.value.amount + a.nonce, delegation_id, a.value.amount ) encoded_inputs.append(encoded_inp) encoded_input_utxos.append(b"\x00") @@ -295,9 +290,7 @@ async def step4_serialize_inputs(self) -> Tuple[List[bytes], List[bytes]]: elif x.change_token_authority: command = 5 token_id = x.change_token_authority.token_id - data = mintlayer_decode_address_to_bytes( - x.change_token_authority.destination - ) + data = decode_nullable_address(x.change_token_authority.destination) elif x.change_token_metadata_uri: command = 8 token_id = x.change_token_metadata_uri.token_id @@ -306,7 +299,7 @@ async def step4_serialize_inputs(self) -> Tuple[List[bytes], List[bytes]]: ord = x.conclude_order encoded_inp = ( mintlayer_utils.encode_conclude_order_account_command_input( - x.nonce, ord.order_id + x.nonce, mintlayer_decode(ord.order_id) ) ) encoded_inputs.append(encoded_inp) @@ -314,11 +307,11 @@ async def step4_serialize_inputs(self) -> Tuple[List[bytes], List[bytes]]: continue elif x.fill_order: ord = x.fill_order - destination = mintlayer_decode_address_to_bytes(ord.destination) + destination = decode_nullable_address(ord.destination) encoded_inp = ( mintlayer_utils.encode_fill_order_account_command_input( x.nonce, - ord.order_id, + mintlayer_decode(ord.order_id), ord.amount, destination, ) @@ -330,7 +323,7 @@ async def step4_serialize_inputs(self) -> Tuple[List[bytes], List[bytes]]: raise Exception("unknown account command") encoded_inp = mintlayer_utils.encode_token_account_command_input( - x.nonce, command, token_id, data + x.nonce, command, mintlayer_decode(token_id), data ) encoded_inputs.append(encoded_inp) encoded_input_utxos.append(b"\x00") @@ -340,30 +333,36 @@ async def step4_serialize_inputs(self) -> Tuple[List[bytes], List[bytes]]: def serialize_output(self, out: MintlayerTxOutput) -> bytes: if out.transfer: x = out.transfer - data = mintlayer_decode_address_to_bytes(x.address) - token_id = b"" if not x.value.token else x.value.token.token_id + data = decode_nullable_address(x.address) + token_id = ( + b"" if not x.value.token else mintlayer_decode(x.value.token.token_id) + ) encoded_out = mintlayer_utils.encode_transfer_output( x.value.amount, token_id, data ) elif out.lock_then_transfer: x = out.lock_then_transfer - data = mintlayer_decode_address_to_bytes(x.address) + data = decode_nullable_address(x.address) lock_type, lock_amount = helpers.get_lock(x.lock) - token_id = b"" if not x.value.token else x.value.token.token_id + token_id = ( + b"" if not x.value.token else mintlayer_decode(x.value.token.token_id) + ) encoded_out = mintlayer_utils.encode_lock_then_transfer_output( x.value.amount, token_id, lock_type, lock_amount, data ) elif out.burn: x = out.burn - token_id = b"" if not x.value.token else x.value.token.token_id + token_id = ( + b"" if not x.value.token else mintlayer_decode(x.value.token.token_id) + ) encoded_out = mintlayer_utils.encode_burn_output(x.value.amount, token_id) elif out.create_stake_pool: x = out.create_stake_pool - staker = mintlayer_decode_address_to_bytes(x.staker) - vrf_public_key = mintlayer_decode_address_to_bytes(x.vrf_public_key) - decommission_key = mintlayer_decode_address_to_bytes(x.decommission_key) + staker = decode_nullable_address(x.staker) + vrf_public_key = decode_nullable_address(x.vrf_public_key) + decommission_key = decode_nullable_address(x.decommission_key) encoded_out = mintlayer_utils.encode_create_stake_pool_output( - x.pool_id, + mintlayer_decode(x.pool_id), x.pledge, staker, vrf_public_key, @@ -373,24 +372,24 @@ def serialize_output(self, out: MintlayerTxOutput) -> bytes: ) elif out.create_delegation_id: x = out.create_delegation_id - destination = mintlayer_decode_address_to_bytes(x.destination) + destination = decode_nullable_address(x.destination) encoded_out = mintlayer_utils.encode_create_delegation_id_output( - destination, x.pool_id + destination, mintlayer_decode(x.pool_id) ) elif out.delegate_staking: x = out.delegate_staking encoded_out = mintlayer_utils.encode_delegate_staking_output( - x.amount, x.delegation_id + x.amount, mintlayer_decode(x.delegation_id) ) elif out.produce_block_from_stake: x = out.produce_block_from_stake - destination = mintlayer_decode_address_to_bytes(x.destination) + destination = decode_nullable_address(x.destination) encoded_out = mintlayer_utils.encode_produce_from_stake_output( - destination, x.pool_id + destination, mintlayer_decode(x.pool_id) ) elif out.issue_fungible_token: x = out.issue_fungible_token - authority = mintlayer_decode_address_to_bytes(x.authority) + authority = decode_nullable_address(x.authority) encoded_out = mintlayer_utils.encode_issue_fungible_token_output( x.token_ticker, x.number_of_decimals, @@ -402,10 +401,10 @@ def serialize_output(self, out: MintlayerTxOutput) -> bytes: ) elif out.issue_nft: x = out.issue_nft - creator = mintlayer_decode_address_to_bytes(x.creator) - destination = mintlayer_decode_address_to_bytes(x.destination) + creator = decode_nullable_address(x.creator) + destination = decode_nullable_address(x.destination) encoded_out = mintlayer_utils.encode_issue_nft_output( - x.token_id, + mintlayer_decode(x.token_id), creator, x.name, x.description, @@ -421,9 +420,11 @@ def serialize_output(self, out: MintlayerTxOutput) -> bytes: encoded_out = mintlayer_utils.encode_data_deposit_output(x.data) elif out.htlc: x = out.htlc - token_id = b"" if not x.value.token else x.value.token.token_id - spend_key = mintlayer_decode_address_to_bytes(x.spend_key) - refund_key = mintlayer_decode_address_to_bytes(x.refund_key) + token_id = ( + b"" if not x.value.token else mintlayer_decode(x.value.token.token_id) + ) + spend_key = decode_nullable_address(x.spend_key) + refund_key = decode_nullable_address(x.refund_key) lock_type, lock_amount = helpers.get_lock(x.refund_timelock) encoded_out = mintlayer_utils.encode_htlc_output( x.value.amount, @@ -434,19 +435,23 @@ def serialize_output(self, out: MintlayerTxOutput) -> bytes: spend_key, x.secret_hash, ) - elif out.anyone_can_take: - x = out.anyone_can_take - conclude_key = mintlayer_decode_address_to_bytes(x.conclude_key) - ask_token_id = b"" if not x.ask.token else x.ask.token.token_id - give_token_id = b"" if not x.give.token else x.give.token.token_id - encoded_out = mintlayer_utils.encode_anyone_can_take_output( + elif out.create_order: + x = out.create_order + conclude_key = decode_nullable_address(x.conclude_key) + ask_token_id = ( + b"" if not x.ask.token else mintlayer_decode(x.ask.token.token_id) + ) + give_token_id = ( + b"" if not x.give.token else mintlayer_decode(x.give.token.token_id) + ) + encoded_out = mintlayer_utils.encode_create_order_output( conclude_key, x.ask.amount, ask_token_id, x.give.amount, give_token_id ) else: raise Exception("unhandled tx output type") return encoded_out - async def step5_serialize_outputs(self) -> List[bytes]: + async def step4_serialize_outputs(self) -> List[bytes]: encoded_outputs = [] for out in self.tx_info.outputs: progress.advance() @@ -455,7 +460,7 @@ async def step5_serialize_outputs(self) -> List[bytes]: return encoded_outputs - async def step6_sign_inputs( + async def step5_sign_inputs( self, encoded_inputs: List[bytes], encoded_input_utxos: List[bytes], @@ -501,7 +506,7 @@ async def step6_sign_inputs( return signatures - async def step7_finish( + async def step6_finish( self, signatures: List[List[Tuple[bytes, int | None]]] ) -> None: sigs = [ diff --git a/core/src/trezor/crypto/bech32.py b/core/src/trezor/crypto/bech32.py index 17a7382dc..4c6dd03ef 100644 --- a/core/src/trezor/crypto/bech32.py +++ b/core/src/trezor/crypto/bech32.py @@ -50,7 +50,6 @@ class Encoding(IntEnum): CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l" _BECH32M_CONST = const(0x2BC830A3) -CHARSET_REV = {char: idx for idx, char in enumerate(CHARSET)} def bech32_polymod(values: list[int]) -> int: @@ -127,60 +126,10 @@ def convertbits( return ret -def reverse_convertbits(data: Sequence[int], frombits: int, tobits: int) -> list[int]: - acc = 0 - bits = 0 - ret = [] - maxv = (1 << frombits) - 1 - for value in data: - if value < 0 or (value >> tobits): - raise ValueError # input value does not match `tobits` size - acc = ((acc << tobits) | value) & ((1 << (frombits + tobits)) - 1) - bits += tobits - while bits >= frombits: - bits -= frombits - ret.append((acc >> bits) & maxv) - return ret - - -def mintlayer_bech32_decode(bech32_str): - if not 1 <= len(bech32_str) <= 90: - raise ValueError("Invalid length of Bech32 string") - - if not (bech32_str.lower() == bech32_str or bech32_str.upper() == bech32_str): - raise ValueError("Mixed case in Bech32 string") - - if "1" not in bech32_str: - raise ValueError("Missing separator in Bech32 string") - - if bech32_str.index("1") == 0 or bech32_str.index("1") == len(bech32_str) - 1: - raise ValueError("Invalid position of separator in Bech32 string") - - hrp, data = bech32_str.rsplit("1", 1) - hrp = hrp.lower() - data = data.lower() - - for char in data: - if char not in CHARSET: - raise ValueError("Invalid character in data part") - - decoded = [] - for char in data: - decoded.append(CHARSET_REV[char]) - - # if not bech32_verify_checksum(hrp, decoded): - # raise ValueError("Invalid checksum") - - return hrp, decoded[:-6] - - -def mintlayer_decode_address_to_bytes(address: str | None) -> bytes: - if address is None: - return bytes() - - _, data = mintlayer_bech32_decode(address) - data = reverse_convertbits(data, 8, 5) - return bytes(data) +def mintlayer_decode(address: str) -> bytes: + _, data, _ = bech32.decode(address) + decoded = bytes(convertbits(data, 5, 8, False)) + return decoded def decode(hrp: str, addr: str) -> OptionalTuple2[int, bytes]: diff --git a/core/src/trezor/messages.py b/core/src/trezor/messages.py index 318c88218..1ebef175c 100644 --- a/core/src/trezor/messages.py +++ b/core/src/trezor/messages.py @@ -4153,7 +4153,6 @@ class MintlayerUtxoTxInput(protobuf.MessageType): prev_index: "int" type: "MintlayerUtxoType" sequence: "int" - value: "MintlayerOutputValue" def __init__( self, @@ -4162,7 +4161,6 @@ def __init__( prev_hash: "bytes", prev_index: "int", type: "MintlayerUtxoType", - value: "MintlayerOutputValue", address_n: "list[MintlayerAddressPath] | None" = None, sequence: "int | None" = None, ) -> None: @@ -4178,7 +4176,7 @@ class MintlayerAccountTxInput(protobuf.MessageType): sequence: "int" value: "MintlayerOutputValue" nonce: "int" - delegation_id: "bytes" + delegation_id: "str" def __init__( self, @@ -4186,7 +4184,7 @@ def __init__( address: "str", value: "MintlayerOutputValue", nonce: "int", - delegation_id: "bytes", + delegation_id: "str", address_n: "list[MintlayerAddressPath] | None" = None, sequence: "int | None" = None, ) -> None: @@ -4235,13 +4233,13 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerAccountCommandTxInput"]: return isinstance(msg, cls) class MintlayerMintTokens(protobuf.MessageType): - token_id: "bytes" + token_id: "str" amount: "bytes" def __init__( self, *, - token_id: "bytes", + token_id: "str", amount: "bytes", ) -> None: pass @@ -4251,12 +4249,12 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerMintTokens"]: return isinstance(msg, cls) class MintlayerUnmintTokens(protobuf.MessageType): - token_id: "bytes" + token_id: "str" def __init__( self, *, - token_id: "bytes", + token_id: "str", ) -> None: pass @@ -4265,12 +4263,12 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerUnmintTokens"]: return isinstance(msg, cls) class MintlayerLockTokenSupply(protobuf.MessageType): - token_id: "bytes" + token_id: "str" def __init__( self, *, - token_id: "bytes", + token_id: "str", ) -> None: pass @@ -4279,13 +4277,13 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerLockTokenSupply"]: return isinstance(msg, cls) class MintlayerFreezeToken(protobuf.MessageType): - token_id: "bytes" + token_id: "str" is_token_unfreezabe: "bool" def __init__( self, *, - token_id: "bytes", + token_id: "str", is_token_unfreezabe: "bool", ) -> None: pass @@ -4295,12 +4293,12 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerFreezeToken"]: return isinstance(msg, cls) class MintlayerUnfreezeToken(protobuf.MessageType): - token_id: "bytes" + token_id: "str" def __init__( self, *, - token_id: "bytes", + token_id: "str", ) -> None: pass @@ -4309,13 +4307,13 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerUnfreezeToken"]: return isinstance(msg, cls) class MintlayerChangeTokenAuhtority(protobuf.MessageType): - token_id: "bytes" + token_id: "str" destination: "str" def __init__( self, *, - token_id: "bytes", + token_id: "str", destination: "str", ) -> None: pass @@ -4325,12 +4323,12 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerChangeTokenAuhtority"]: return isinstance(msg, cls) class MintlayerConcludeOrder(protobuf.MessageType): - order_id: "bytes" + order_id: "str" def __init__( self, *, - order_id: "bytes", + order_id: "str", ) -> None: pass @@ -4339,14 +4337,14 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerConcludeOrder"]: return isinstance(msg, cls) class MintlayerFillOrder(protobuf.MessageType): - order_id: "bytes" + order_id: "str" amount: "bytes" destination: "str" def __init__( self, *, - order_id: "bytes", + order_id: "str", amount: "bytes", destination: "str", ) -> None: @@ -4357,13 +4355,13 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerFillOrder"]: return isinstance(msg, cls) class MintlayerChangeTokenMetadataUri(protobuf.MessageType): - token_id: "bytes" + token_id: "str" metadata_uri: "bytes" def __init__( self, *, - token_id: "bytes", + token_id: "str", metadata_uri: "bytes", ) -> None: pass @@ -4384,7 +4382,7 @@ class MintlayerTxOutput(protobuf.MessageType): issue_nft: "MintlayerIssueNftTxOutput | None" data_deposit: "MintlayerDataDepositTxOutput | None" htlc: "MintlayerHtlcTxOutput | None" - anyone_can_take: "MintlayerAnyoneCanTakeTxOutput | None" + create_order: "MintlayerCreateOrderTxOutput | None" def __init__( self, @@ -4400,7 +4398,7 @@ def __init__( issue_nft: "MintlayerIssueNftTxOutput | None" = None, data_deposit: "MintlayerDataDepositTxOutput | None" = None, htlc: "MintlayerHtlcTxOutput | None" = None, - anyone_can_take: "MintlayerAnyoneCanTakeTxOutput | None" = None, + create_order: "MintlayerCreateOrderTxOutput | None" = None, ) -> None: pass @@ -4409,14 +4407,14 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerTxOutput"]: return isinstance(msg, cls) class MintlayerTokenOutputValue(protobuf.MessageType): - token_id: "bytes" + token_id: "str" token_ticker: "bytes" number_of_decimals: "int" def __init__( self, *, - token_id: "bytes", + token_id: "str", token_ticker: "bytes", number_of_decimals: "int", ) -> None: @@ -4479,16 +4477,16 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerOutputTimeLock"]: return isinstance(msg, cls) class MintlayerLockThenTransferTxOutput(protobuf.MessageType): - address: "str | None" + address: "str" value: "MintlayerOutputValue" lock: "MintlayerOutputTimeLock" def __init__( self, *, + address: "str", value: "MintlayerOutputValue", lock: "MintlayerOutputTimeLock", - address: "str | None" = None, ) -> None: pass @@ -4511,7 +4509,7 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerBurnTxOutput"]: return isinstance(msg, cls) class MintlayerCreateStakePoolTxOutput(protobuf.MessageType): - pool_id: "bytes" + pool_id: "str" pledge: "bytes" staker: "str" vrf_public_key: "str" @@ -4522,7 +4520,7 @@ class MintlayerCreateStakePoolTxOutput(protobuf.MessageType): def __init__( self, *, - pool_id: "bytes", + pool_id: "str", pledge: "bytes", staker: "str", vrf_public_key: "str", @@ -4538,13 +4536,13 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerCreateStakePoolTxOutput"]: class MintlayerProduceBlockFromStakeTxOutput(protobuf.MessageType): destination: "str" - pool_id: "bytes" + pool_id: "str" def __init__( self, *, destination: "str", - pool_id: "bytes", + pool_id: "str", ) -> None: pass @@ -4554,13 +4552,13 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerProduceBlockFromStakeTxOutp class MintlayerCreateDelegationIdTxOutput(protobuf.MessageType): destination: "str" - pool_id: "bytes" + pool_id: "str" def __init__( self, *, destination: "str", - pool_id: "bytes", + pool_id: "str", ) -> None: pass @@ -4570,13 +4568,13 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerCreateDelegationIdTxOutput" class MintlayerDelegateStakingTxOutput(protobuf.MessageType): amount: "bytes" - delegation_id: "bytes" + delegation_id: "str" def __init__( self, *, amount: "bytes", - delegation_id: "bytes", + delegation_id: "str", ) -> None: pass @@ -4625,7 +4623,7 @@ def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerIssueFungibleTokenTxOutput" return isinstance(msg, cls) class MintlayerIssueNftTxOutput(protobuf.MessageType): - token_id: "bytes" + token_id: "str" destination: "str" creator: "str | None" name: "bytes" @@ -4639,7 +4637,7 @@ class MintlayerIssueNftTxOutput(protobuf.MessageType): def __init__( self, *, - token_id: "bytes", + token_id: "str", destination: "str", name: "bytes", description: "bytes", @@ -4692,7 +4690,7 @@ def __init__( def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerHtlcTxOutput"]: return isinstance(msg, cls) - class MintlayerAnyoneCanTakeTxOutput(protobuf.MessageType): + class MintlayerCreateOrderTxOutput(protobuf.MessageType): conclude_key: "str" ask: "MintlayerOutputValue" give: "MintlayerOutputValue" @@ -4707,55 +4705,7 @@ def __init__( pass @classmethod - def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerAnyoneCanTakeTxOutput"]: - return isinstance(msg, cls) - - class MintlayerPrevTx(protobuf.MessageType): - version: "int" - inputs_count: "int" - outputs_count: "int" - - def __init__( - self, - *, - version: "int", - inputs_count: "int", - outputs_count: "int", - ) -> None: - pass - - @classmethod - def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerPrevTx"]: - return isinstance(msg, cls) - - class MintlayerPrevInput(protobuf.MessageType): - prev_hash: "bytes" - prev_index: "int" - - def __init__( - self, - *, - prev_hash: "bytes", - prev_index: "int", - ) -> None: - pass - - @classmethod - def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerPrevInput"]: - return isinstance(msg, cls) - - class MintlayerPrevTransferOutput(protobuf.MessageType): - value: "MintlayerOutputValue" - - def __init__( - self, - *, - value: "MintlayerOutputValue", - ) -> None: - pass - - @classmethod - def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerPrevTransferOutput"]: + def is_type_of(cls, msg: Any) -> TypeGuard["MintlayerCreateOrderTxOutput"]: return isinstance(msg, cls) class MintlayerTxAckUtxoInput(protobuf.MessageType): diff --git a/python/src/trezorlib/messages.py b/python/src/trezorlib/messages.py index 02285bdac..cc45c7c1c 100644 --- a/python/src/trezorlib/messages.py +++ b/python/src/trezorlib/messages.py @@ -5532,7 +5532,6 @@ class MintlayerUtxoTxInput(protobuf.MessageType): 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__( @@ -5542,7 +5541,6 @@ def __init__( prev_hash: "bytes", prev_index: "int", type: "MintlayerUtxoType", - value: "MintlayerOutputValue", address_n: Optional[Sequence["MintlayerAddressPath"]] = None, sequence: Optional["int"] = 4294967295, ) -> None: @@ -5551,7 +5549,6 @@ def __init__( self.prev_hash = prev_hash self.prev_index = prev_index self.type = type - self.value = value self.sequence = sequence @@ -5563,7 +5560,7 @@ class MintlayerAccountTxInput(protobuf.MessageType): 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), + 6: protobuf.Field("delegation_id", "string", repeated=False, required=True), } def __init__( @@ -5572,7 +5569,7 @@ def __init__( address: "str", value: "MintlayerOutputValue", nonce: "int", - delegation_id: "bytes", + delegation_id: "str", address_n: Optional[Sequence["MintlayerAddressPath"]] = None, sequence: Optional["int"] = 4294967295, ) -> None: @@ -5637,14 +5634,14 @@ def __init__( class MintlayerMintTokens(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + 1: protobuf.Field("token_id", "string", repeated=False, required=True), 2: protobuf.Field("amount", "bytes", repeated=False, required=True), } def __init__( self, *, - token_id: "bytes", + token_id: "str", amount: "bytes", ) -> None: self.token_id = token_id @@ -5654,13 +5651,13 @@ def __init__( class MintlayerUnmintTokens(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + 1: protobuf.Field("token_id", "string", repeated=False, required=True), } def __init__( self, *, - token_id: "bytes", + token_id: "str", ) -> None: self.token_id = token_id @@ -5668,13 +5665,13 @@ def __init__( class MintlayerLockTokenSupply(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + 1: protobuf.Field("token_id", "string", repeated=False, required=True), } def __init__( self, *, - token_id: "bytes", + token_id: "str", ) -> None: self.token_id = token_id @@ -5682,14 +5679,14 @@ def __init__( class MintlayerFreezeToken(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + 1: protobuf.Field("token_id", "string", repeated=False, required=True), 2: protobuf.Field("is_token_unfreezabe", "bool", repeated=False, required=True), } def __init__( self, *, - token_id: "bytes", + token_id: "str", is_token_unfreezabe: "bool", ) -> None: self.token_id = token_id @@ -5699,13 +5696,13 @@ def __init__( class MintlayerUnfreezeToken(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + 1: protobuf.Field("token_id", "string", repeated=False, required=True), } def __init__( self, *, - token_id: "bytes", + token_id: "str", ) -> None: self.token_id = token_id @@ -5713,14 +5710,14 @@ def __init__( class MintlayerChangeTokenAuhtority(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + 1: protobuf.Field("token_id", "string", repeated=False, required=True), 2: protobuf.Field("destination", "string", repeated=False, required=True), } def __init__( self, *, - token_id: "bytes", + token_id: "str", destination: "str", ) -> None: self.token_id = token_id @@ -5730,13 +5727,13 @@ def __init__( class MintlayerConcludeOrder(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("order_id", "bytes", repeated=False, required=True), + 1: protobuf.Field("order_id", "string", repeated=False, required=True), } def __init__( self, *, - order_id: "bytes", + order_id: "str", ) -> None: self.order_id = order_id @@ -5744,7 +5741,7 @@ def __init__( class MintlayerFillOrder(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("order_id", "bytes", repeated=False, required=True), + 1: protobuf.Field("order_id", "string", repeated=False, required=True), 2: protobuf.Field("amount", "bytes", repeated=False, required=True), 3: protobuf.Field("destination", "string", repeated=False, required=True), } @@ -5752,7 +5749,7 @@ class MintlayerFillOrder(protobuf.MessageType): def __init__( self, *, - order_id: "bytes", + order_id: "str", amount: "bytes", destination: "str", ) -> None: @@ -5764,14 +5761,14 @@ def __init__( class MintlayerChangeTokenMetadataUri(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + 1: protobuf.Field("token_id", "string", repeated=False, required=True), 2: protobuf.Field("metadata_uri", "bytes", repeated=False, required=True), } def __init__( self, *, - token_id: "bytes", + token_id: "str", metadata_uri: "bytes", ) -> None: self.token_id = token_id @@ -5792,7 +5789,7 @@ class MintlayerTxOutput(protobuf.MessageType): 9: protobuf.Field("issue_nft", "MintlayerIssueNftTxOutput", repeated=False, required=False, default=None), 10: protobuf.Field("data_deposit", "MintlayerDataDepositTxOutput", repeated=False, required=False, default=None), 11: protobuf.Field("htlc", "MintlayerHtlcTxOutput", repeated=False, required=False, default=None), - 12: protobuf.Field("anyone_can_take", "MintlayerAnyoneCanTakeTxOutput", repeated=False, required=False, default=None), + 12: protobuf.Field("create_order", "MintlayerCreateOrderTxOutput", repeated=False, required=False, default=None), } def __init__( @@ -5809,7 +5806,7 @@ def __init__( issue_nft: Optional["MintlayerIssueNftTxOutput"] = None, data_deposit: Optional["MintlayerDataDepositTxOutput"] = None, htlc: Optional["MintlayerHtlcTxOutput"] = None, - anyone_can_take: Optional["MintlayerAnyoneCanTakeTxOutput"] = None, + create_order: Optional["MintlayerCreateOrderTxOutput"] = None, ) -> None: self.transfer = transfer self.lock_then_transfer = lock_then_transfer @@ -5822,13 +5819,13 @@ def __init__( self.issue_nft = issue_nft self.data_deposit = data_deposit self.htlc = htlc - self.anyone_can_take = anyone_can_take + self.create_order = create_order class MintlayerTokenOutputValue(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + 1: protobuf.Field("token_id", "string", repeated=False, required=True), 2: protobuf.Field("token_ticker", "bytes", repeated=False, required=True), 3: protobuf.Field("number_of_decimals", "uint32", repeated=False, required=True), } @@ -5836,7 +5833,7 @@ class MintlayerTokenOutputValue(protobuf.MessageType): def __init__( self, *, - token_id: "bytes", + token_id: "str", token_ticker: "bytes", number_of_decimals: "int", ) -> None: @@ -5905,7 +5902,7 @@ def __init__( class MintlayerLockThenTransferTxOutput(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("address", "string", repeated=False, required=False, default=None), + 1: protobuf.Field("address", "string", repeated=False, required=True), 2: protobuf.Field("value", "MintlayerOutputValue", repeated=False, required=True), 3: protobuf.Field("lock", "MintlayerOutputTimeLock", repeated=False, required=True), } @@ -5913,13 +5910,13 @@ class MintlayerLockThenTransferTxOutput(protobuf.MessageType): def __init__( self, *, + address: "str", value: "MintlayerOutputValue", lock: "MintlayerOutputTimeLock", - address: Optional["str"] = None, ) -> None: + self.address = address self.value = value self.lock = lock - self.address = address class MintlayerBurnTxOutput(protobuf.MessageType): @@ -5939,7 +5936,7 @@ def __init__( class MintlayerCreateStakePoolTxOutput(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("pool_id", "bytes", repeated=False, required=True), + 1: protobuf.Field("pool_id", "string", 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), @@ -5951,7 +5948,7 @@ class MintlayerCreateStakePoolTxOutput(protobuf.MessageType): def __init__( self, *, - pool_id: "bytes", + pool_id: "str", pledge: "bytes", staker: "str", vrf_public_key: "str", @@ -5972,14 +5969,14 @@ 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), + 2: protobuf.Field("pool_id", "string", repeated=False, required=True), } def __init__( self, *, destination: "str", - pool_id: "bytes", + pool_id: "str", ) -> None: self.destination = destination self.pool_id = pool_id @@ -5989,14 +5986,14 @@ 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), + 2: protobuf.Field("pool_id", "string", repeated=False, required=True), } def __init__( self, *, destination: "str", - pool_id: "bytes", + pool_id: "str", ) -> None: self.destination = destination self.pool_id = pool_id @@ -6006,14 +6003,14 @@ 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), + 2: protobuf.Field("delegation_id", "string", repeated=False, required=True), } def __init__( self, *, amount: "bytes", - delegation_id: "bytes", + delegation_id: "str", ) -> None: self.amount = amount self.delegation_id = delegation_id @@ -6068,7 +6065,7 @@ def __init__( class MintlayerIssueNftTxOutput(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("token_id", "bytes", repeated=False, required=True), + 1: protobuf.Field("token_id", "string", 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), @@ -6083,7 +6080,7 @@ class MintlayerIssueNftTxOutput(protobuf.MessageType): def __init__( self, *, - token_id: "bytes", + token_id: "str", destination: "str", name: "bytes", description: "bytes", @@ -6146,7 +6143,7 @@ def __init__( self.refund_key = refund_key -class MintlayerAnyoneCanTakeTxOutput(protobuf.MessageType): +class MintlayerCreateOrderTxOutput(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { 1: protobuf.Field("conclude_key", "string", repeated=False, required=True), @@ -6166,57 +6163,6 @@ def __init__( self.give = give -class MintlayerPrevTx(protobuf.MessageType): - MESSAGE_WIRE_TYPE = None - FIELDS = { - 1: protobuf.Field("version", "uint32", repeated=False, required=True), - 6: protobuf.Field("inputs_count", "uint32", repeated=False, required=True), - 7: protobuf.Field("outputs_count", "uint32", repeated=False, required=True), - } - - def __init__( - self, - *, - version: "int", - inputs_count: "int", - outputs_count: "int", - ) -> None: - self.version = version - self.inputs_count = inputs_count - self.outputs_count = outputs_count - - -class MintlayerPrevInput(protobuf.MessageType): - MESSAGE_WIRE_TYPE = None - FIELDS = { - 2: protobuf.Field("prev_hash", "bytes", repeated=False, required=True), - 3: protobuf.Field("prev_index", "uint32", repeated=False, required=True), - } - - def __init__( - self, - *, - prev_hash: "bytes", - prev_index: "int", - ) -> None: - self.prev_hash = prev_hash - self.prev_index = prev_index - - -class MintlayerPrevTransferOutput(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 MintlayerTxAckUtxoInput(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1007 FIELDS = { @@ -6302,7 +6248,7 @@ def __init__( class MintlayerTxAckInputWrapper(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 2: protobuf.Field("input", "MintlayerTxInput", repeated=False, required=True), + 1: protobuf.Field("input", "MintlayerTxInput", repeated=False, required=True), } def __init__( @@ -6316,7 +6262,7 @@ def __init__( class MintlayerTxAckOutputWrapper(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 5: protobuf.Field("output", "MintlayerTxOutput", repeated=False, required=True), + 1: protobuf.Field("output", "MintlayerTxOutput", repeated=False, required=True), } def __init__( diff --git a/rust/trezor-client/src/protos/generated/messages_mintlayer.rs b/rust/trezor-client/src/protos/generated/messages_mintlayer.rs index cf55032c4..0e62dd9d1 100644 --- a/rust/trezor-client/src/protos/generated/messages_mintlayer.rs +++ b/rust/trezor-client/src/protos/generated/messages_mintlayer.rs @@ -2532,8 +2532,6 @@ pub struct MintlayerUtxoTxInput { pub type_: ::std::option::Option<::protobuf::EnumOrUnknown>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.sequence) pub sequence: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.value) - pub value: ::protobuf::MessageField, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerUtxoTxInput.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -2683,7 +2681,7 @@ impl MintlayerUtxoTxInput { } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(7); + 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", @@ -2715,11 +2713,6 @@ impl MintlayerUtxoTxInput { |m: &MintlayerUtxoTxInput| { &m.sequence }, |m: &mut MintlayerUtxoTxInput| { &mut m.sequence }, )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( - "value", - |m: &MintlayerUtxoTxInput| { &m.value }, - |m: &mut MintlayerUtxoTxInput| { &mut m.value }, - )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MintlayerUtxoTxInput", fields, @@ -2744,19 +2737,11 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { if self.type_.is_none() { return false; } - if self.value.is_none() { - return false; - } for v in &self.address_n { if !v.is_initialized() { return false; } }; - for v in &self.value { - if !v.is_initialized() { - return false; - } - }; true } @@ -2781,9 +2766,6 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { 48 => { self.sequence = ::std::option::Option::Some(is.read_uint32()?); }, - 58 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; - }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, @@ -2815,10 +2797,6 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { 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 @@ -2843,9 +2821,6 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { 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(()) } @@ -2869,7 +2844,6 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { 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(); } @@ -2881,7 +2855,6 @@ impl ::protobuf::Message for MintlayerUtxoTxInput { 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 @@ -2920,7 +2893,7 @@ pub struct MintlayerAccountTxInput { // @@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>, + pub delegation_id: ::std::option::Option<::std::string::String>, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerAccountTxInput.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -3011,12 +2984,12 @@ impl MintlayerAccountTxInput { self.nonce = ::std::option::Option::Some(v); } - // required bytes delegation_id = 6; + // required string delegation_id = 6; - pub fn delegation_id(&self) -> &[u8] { + pub fn delegation_id(&self) -> &str { match self.delegation_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -3029,22 +3002,22 @@ impl MintlayerAccountTxInput { } // Param is passed by value, moved - pub fn set_delegation_id(&mut self, v: ::std::vec::Vec) { + pub fn set_delegation_id(&mut self, v: ::std::string::String) { 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 { + pub fn mut_delegation_id(&mut self) -> &mut ::std::string::String { if self.delegation_id.is_none() { - self.delegation_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.delegation_id = ::std::option::Option::Some(::std::string::String::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()) + pub fn take_delegation_id(&mut self) -> ::std::string::String { + self.delegation_id.take().unwrap_or_else(|| ::std::string::String::new()) } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { @@ -3136,7 +3109,7 @@ impl ::protobuf::Message for MintlayerAccountTxInput { self.nonce = ::std::option::Option::Some(is.read_uint64()?); }, 50 => { - self.delegation_id = ::std::option::Option::Some(is.read_bytes()?); + self.delegation_id = ::std::option::Option::Some(is.read_string()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -3168,7 +3141,7 @@ impl ::protobuf::Message for MintlayerAccountTxInput { 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::string_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); @@ -3192,7 +3165,7 @@ impl ::protobuf::Message for MintlayerAccountTxInput { os.write_uint64(5, v)?; } if let Some(v) = self.delegation_id.as_ref() { - os.write_bytes(6, v)?; + os.write_string(6, v)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -3734,7 +3707,7 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerAccountCommandTxInput { 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>, + pub token_id: ::std::option::Option<::std::string::String>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerMintTokens.amount) pub amount: ::std::option::Option<::std::vec::Vec>, // special fields @@ -3753,12 +3726,12 @@ impl MintlayerMintTokens { ::std::default::Default::default() } - // required bytes token_id = 1; + // required string token_id = 1; - pub fn token_id(&self) -> &[u8] { + pub fn token_id(&self) -> &str { match self.token_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -3771,22 +3744,22 @@ impl MintlayerMintTokens { } // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + pub fn set_token_id(&mut self, v: ::std::string::String) { 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 { + pub fn mut_token_id(&mut self) -> &mut ::std::string::String { if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.token_id = ::std::option::Option::Some(::std::string::String::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()) + pub fn take_token_id(&mut self) -> ::std::string::String { + self.token_id.take().unwrap_or_else(|| ::std::string::String::new()) } // required bytes amount = 2; @@ -3863,7 +3836,7 @@ impl ::protobuf::Message for MintlayerMintTokens { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); + self.token_id = ::std::option::Option::Some(is.read_string()?); }, 18 => { self.amount = ::std::option::Option::Some(is.read_bytes()?); @@ -3881,7 +3854,7 @@ impl ::protobuf::Message for MintlayerMintTokens { 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::string_size(1, &v); } if let Some(v) = self.amount.as_ref() { my_size += ::protobuf::rt::bytes_size(2, &v); @@ -3893,7 +3866,7 @@ impl ::protobuf::Message for MintlayerMintTokens { 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_string(1, v)?; } if let Some(v) = self.amount.as_ref() { os.write_bytes(2, v)?; @@ -3952,7 +3925,7 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerMintTokens { 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>, + pub token_id: ::std::option::Option<::std::string::String>, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerUnmintTokens.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -3969,12 +3942,12 @@ impl MintlayerUnmintTokens { ::std::default::Default::default() } - // required bytes token_id = 1; + // required string token_id = 1; - pub fn token_id(&self) -> &[u8] { + pub fn token_id(&self) -> &str { match self.token_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -3987,22 +3960,22 @@ impl MintlayerUnmintTokens { } // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + pub fn set_token_id(&mut self, v: ::std::string::String) { 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 { + pub fn mut_token_id(&mut self) -> &mut ::std::string::String { if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.token_id = ::std::option::Option::Some(::std::string::String::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()) + pub fn take_token_id(&mut self) -> ::std::string::String { + self.token_id.take().unwrap_or_else(|| ::std::string::String::new()) } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { @@ -4035,7 +4008,7 @@ impl ::protobuf::Message for MintlayerUnmintTokens { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); + self.token_id = ::std::option::Option::Some(is.read_string()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -4050,7 +4023,7 @@ impl ::protobuf::Message for MintlayerUnmintTokens { 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::string_size(1, &v); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); @@ -4059,7 +4032,7 @@ impl ::protobuf::Message for MintlayerUnmintTokens { 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_string(1, v)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -4113,7 +4086,7 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerUnmintTokens { 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>, + pub token_id: ::std::option::Option<::std::string::String>, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerLockTokenSupply.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -4130,12 +4103,12 @@ impl MintlayerLockTokenSupply { ::std::default::Default::default() } - // required bytes token_id = 1; + // required string token_id = 1; - pub fn token_id(&self) -> &[u8] { + pub fn token_id(&self) -> &str { match self.token_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -4148,22 +4121,22 @@ impl MintlayerLockTokenSupply { } // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + pub fn set_token_id(&mut self, v: ::std::string::String) { 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 { + pub fn mut_token_id(&mut self) -> &mut ::std::string::String { if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.token_id = ::std::option::Option::Some(::std::string::String::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()) + pub fn take_token_id(&mut self) -> ::std::string::String { + self.token_id.take().unwrap_or_else(|| ::std::string::String::new()) } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { @@ -4196,7 +4169,7 @@ impl ::protobuf::Message for MintlayerLockTokenSupply { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); + self.token_id = ::std::option::Option::Some(is.read_string()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -4211,7 +4184,7 @@ impl ::protobuf::Message for MintlayerLockTokenSupply { 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::string_size(1, &v); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); @@ -4220,7 +4193,7 @@ impl ::protobuf::Message for MintlayerLockTokenSupply { 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_string(1, v)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -4274,7 +4247,7 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerLockTokenSupply { 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>, + pub token_id: ::std::option::Option<::std::string::String>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerFreezeToken.is_token_unfreezabe) pub is_token_unfreezabe: ::std::option::Option, // special fields @@ -4293,12 +4266,12 @@ impl MintlayerFreezeToken { ::std::default::Default::default() } - // required bytes token_id = 1; + // required string token_id = 1; - pub fn token_id(&self) -> &[u8] { + pub fn token_id(&self) -> &str { match self.token_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -4311,22 +4284,22 @@ impl MintlayerFreezeToken { } // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + pub fn set_token_id(&mut self, v: ::std::string::String) { 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 { + pub fn mut_token_id(&mut self) -> &mut ::std::string::String { if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.token_id = ::std::option::Option::Some(::std::string::String::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()) + pub fn take_token_id(&mut self) -> ::std::string::String { + self.token_id.take().unwrap_or_else(|| ::std::string::String::new()) } // required bool is_token_unfreezabe = 2; @@ -4386,7 +4359,7 @@ impl ::protobuf::Message for MintlayerFreezeToken { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); + self.token_id = ::std::option::Option::Some(is.read_string()?); }, 16 => { self.is_token_unfreezabe = ::std::option::Option::Some(is.read_bool()?); @@ -4404,7 +4377,7 @@ impl ::protobuf::Message for MintlayerFreezeToken { 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::string_size(1, &v); } if let Some(v) = self.is_token_unfreezabe { my_size += 1 + 1; @@ -4416,7 +4389,7 @@ impl ::protobuf::Message for MintlayerFreezeToken { 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_string(1, v)?; } if let Some(v) = self.is_token_unfreezabe { os.write_bool(2, v)?; @@ -4475,7 +4448,7 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerFreezeToken { 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>, + pub token_id: ::std::option::Option<::std::string::String>, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerUnfreezeToken.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -4492,12 +4465,12 @@ impl MintlayerUnfreezeToken { ::std::default::Default::default() } - // required bytes token_id = 1; + // required string token_id = 1; - pub fn token_id(&self) -> &[u8] { + pub fn token_id(&self) -> &str { match self.token_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -4510,22 +4483,22 @@ impl MintlayerUnfreezeToken { } // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + pub fn set_token_id(&mut self, v: ::std::string::String) { 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 { + pub fn mut_token_id(&mut self) -> &mut ::std::string::String { if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.token_id = ::std::option::Option::Some(::std::string::String::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()) + pub fn take_token_id(&mut self) -> ::std::string::String { + self.token_id.take().unwrap_or_else(|| ::std::string::String::new()) } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { @@ -4558,7 +4531,7 @@ impl ::protobuf::Message for MintlayerUnfreezeToken { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); + self.token_id = ::std::option::Option::Some(is.read_string()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -4573,7 +4546,7 @@ impl ::protobuf::Message for MintlayerUnfreezeToken { 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::string_size(1, &v); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); @@ -4582,7 +4555,7 @@ impl ::protobuf::Message for MintlayerUnfreezeToken { 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_string(1, v)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -4636,7 +4609,7 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerUnfreezeToken { 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>, + pub token_id: ::std::option::Option<::std::string::String>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerChangeTokenAuhtority.destination) pub destination: ::std::option::Option<::std::string::String>, // special fields @@ -4655,12 +4628,12 @@ impl MintlayerChangeTokenAuhtority { ::std::default::Default::default() } - // required bytes token_id = 1; + // required string token_id = 1; - pub fn token_id(&self) -> &[u8] { + pub fn token_id(&self) -> &str { match self.token_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -4673,22 +4646,22 @@ impl MintlayerChangeTokenAuhtority { } // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + pub fn set_token_id(&mut self, v: ::std::string::String) { 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 { + pub fn mut_token_id(&mut self) -> &mut ::std::string::String { if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.token_id = ::std::option::Option::Some(::std::string::String::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()) + pub fn take_token_id(&mut self) -> ::std::string::String { + self.token_id.take().unwrap_or_else(|| ::std::string::String::new()) } // required string destination = 2; @@ -4765,7 +4738,7 @@ impl ::protobuf::Message for MintlayerChangeTokenAuhtority { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); + self.token_id = ::std::option::Option::Some(is.read_string()?); }, 18 => { self.destination = ::std::option::Option::Some(is.read_string()?); @@ -4783,7 +4756,7 @@ impl ::protobuf::Message for MintlayerChangeTokenAuhtority { 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::string_size(1, &v); } if let Some(v) = self.destination.as_ref() { my_size += ::protobuf::rt::string_size(2, &v); @@ -4795,7 +4768,7 @@ impl ::protobuf::Message for MintlayerChangeTokenAuhtority { 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_string(1, v)?; } if let Some(v) = self.destination.as_ref() { os.write_string(2, v)?; @@ -4854,7 +4827,7 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerChangeTokenAuhtority { pub struct MintlayerConcludeOrder { // message fields // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerConcludeOrder.order_id) - pub order_id: ::std::option::Option<::std::vec::Vec>, + pub order_id: ::std::option::Option<::std::string::String>, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerConcludeOrder.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -4871,12 +4844,12 @@ impl MintlayerConcludeOrder { ::std::default::Default::default() } - // required bytes order_id = 1; + // required string order_id = 1; - pub fn order_id(&self) -> &[u8] { + pub fn order_id(&self) -> &str { match self.order_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -4889,22 +4862,22 @@ impl MintlayerConcludeOrder { } // Param is passed by value, moved - pub fn set_order_id(&mut self, v: ::std::vec::Vec) { + pub fn set_order_id(&mut self, v: ::std::string::String) { self.order_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_order_id(&mut self) -> &mut ::std::vec::Vec { + pub fn mut_order_id(&mut self) -> &mut ::std::string::String { if self.order_id.is_none() { - self.order_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.order_id = ::std::option::Option::Some(::std::string::String::new()); } self.order_id.as_mut().unwrap() } // Take field - pub fn take_order_id(&mut self) -> ::std::vec::Vec { - self.order_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + pub fn take_order_id(&mut self) -> ::std::string::String { + self.order_id.take().unwrap_or_else(|| ::std::string::String::new()) } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { @@ -4937,7 +4910,7 @@ impl ::protobuf::Message for MintlayerConcludeOrder { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - self.order_id = ::std::option::Option::Some(is.read_bytes()?); + self.order_id = ::std::option::Option::Some(is.read_string()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -4952,7 +4925,7 @@ impl ::protobuf::Message for MintlayerConcludeOrder { fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.order_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); + my_size += ::protobuf::rt::string_size(1, &v); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); @@ -4961,7 +4934,7 @@ impl ::protobuf::Message for MintlayerConcludeOrder { fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.order_id.as_ref() { - os.write_bytes(1, v)?; + os.write_string(1, v)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -5015,7 +4988,7 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerConcludeOrder { pub struct MintlayerFillOrder { // message fields // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerFillOrder.order_id) - pub order_id: ::std::option::Option<::std::vec::Vec>, + pub order_id: ::std::option::Option<::std::string::String>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerFillOrder.amount) pub amount: ::std::option::Option<::std::vec::Vec>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerFillOrder.destination) @@ -5036,12 +5009,12 @@ impl MintlayerFillOrder { ::std::default::Default::default() } - // required bytes order_id = 1; + // required string order_id = 1; - pub fn order_id(&self) -> &[u8] { + pub fn order_id(&self) -> &str { match self.order_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -5054,22 +5027,22 @@ impl MintlayerFillOrder { } // Param is passed by value, moved - pub fn set_order_id(&mut self, v: ::std::vec::Vec) { + pub fn set_order_id(&mut self, v: ::std::string::String) { self.order_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_order_id(&mut self) -> &mut ::std::vec::Vec { + pub fn mut_order_id(&mut self) -> &mut ::std::string::String { if self.order_id.is_none() { - self.order_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.order_id = ::std::option::Option::Some(::std::string::String::new()); } self.order_id.as_mut().unwrap() } // Take field - pub fn take_order_id(&mut self) -> ::std::vec::Vec { - self.order_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + pub fn take_order_id(&mut self) -> ::std::string::String { + self.order_id.take().unwrap_or_else(|| ::std::string::String::new()) } // required bytes amount = 2; @@ -5190,7 +5163,7 @@ impl ::protobuf::Message for MintlayerFillOrder { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - self.order_id = ::std::option::Option::Some(is.read_bytes()?); + self.order_id = ::std::option::Option::Some(is.read_string()?); }, 18 => { self.amount = ::std::option::Option::Some(is.read_bytes()?); @@ -5211,7 +5184,7 @@ impl ::protobuf::Message for MintlayerFillOrder { fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.order_id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); + my_size += ::protobuf::rt::string_size(1, &v); } if let Some(v) = self.amount.as_ref() { my_size += ::protobuf::rt::bytes_size(2, &v); @@ -5226,7 +5199,7 @@ impl ::protobuf::Message for MintlayerFillOrder { fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.order_id.as_ref() { - os.write_bytes(1, v)?; + os.write_string(1, v)?; } if let Some(v) = self.amount.as_ref() { os.write_bytes(2, v)?; @@ -5290,7 +5263,7 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerFillOrder { pub struct MintlayerChangeTokenMetadataUri { // message fields // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerChangeTokenMetadataUri.token_id) - pub token_id: ::std::option::Option<::std::vec::Vec>, + pub token_id: ::std::option::Option<::std::string::String>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerChangeTokenMetadataUri.metadata_uri) pub metadata_uri: ::std::option::Option<::std::vec::Vec>, // special fields @@ -5309,12 +5282,12 @@ impl MintlayerChangeTokenMetadataUri { ::std::default::Default::default() } - // required bytes token_id = 1; + // required string token_id = 1; - pub fn token_id(&self) -> &[u8] { + pub fn token_id(&self) -> &str { match self.token_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -5327,22 +5300,22 @@ impl MintlayerChangeTokenMetadataUri { } // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + pub fn set_token_id(&mut self, v: ::std::string::String) { 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 { + pub fn mut_token_id(&mut self) -> &mut ::std::string::String { if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.token_id = ::std::option::Option::Some(::std::string::String::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()) + pub fn take_token_id(&mut self) -> ::std::string::String { + self.token_id.take().unwrap_or_else(|| ::std::string::String::new()) } // required bytes metadata_uri = 2; @@ -5419,7 +5392,7 @@ impl ::protobuf::Message for MintlayerChangeTokenMetadataUri { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); + self.token_id = ::std::option::Option::Some(is.read_string()?); }, 18 => { self.metadata_uri = ::std::option::Option::Some(is.read_bytes()?); @@ -5437,7 +5410,7 @@ impl ::protobuf::Message for MintlayerChangeTokenMetadataUri { 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::string_size(1, &v); } if let Some(v) = self.metadata_uri.as_ref() { my_size += ::protobuf::rt::bytes_size(2, &v); @@ -5449,7 +5422,7 @@ impl ::protobuf::Message for MintlayerChangeTokenMetadataUri { 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_string(1, v)?; } if let Some(v) = self.metadata_uri.as_ref() { os.write_bytes(2, v)?; @@ -5529,8 +5502,8 @@ pub struct MintlayerTxOutput { pub data_deposit: ::protobuf::MessageField, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.htlc) pub htlc: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.anyone_can_take) - pub anyone_can_take: ::protobuf::MessageField, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxOutput.create_order) + pub create_order: ::protobuf::MessageField, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxOutput.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -5605,10 +5578,10 @@ impl MintlayerTxOutput { |m: &MintlayerTxOutput| { &m.htlc }, |m: &mut MintlayerTxOutput| { &mut m.htlc }, )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerAnyoneCanTakeTxOutput>( - "anyone_can_take", - |m: &MintlayerTxOutput| { &m.anyone_can_take }, - |m: &mut MintlayerTxOutput| { &mut m.anyone_can_take }, + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerCreateOrderTxOutput>( + "create_order", + |m: &MintlayerTxOutput| { &m.create_order }, + |m: &mut MintlayerTxOutput| { &mut m.create_order }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MintlayerTxOutput", @@ -5677,7 +5650,7 @@ impl ::protobuf::Message for MintlayerTxOutput { return false; } }; - for v in &self.anyone_can_take { + for v in &self.create_order { if !v.is_initialized() { return false; } @@ -5722,7 +5695,7 @@ impl ::protobuf::Message for MintlayerTxOutput { ::protobuf::rt::read_singular_message_into_field(is, &mut self.htlc)?; }, 98 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.anyone_can_take)?; + ::protobuf::rt::read_singular_message_into_field(is, &mut self.create_order)?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -5780,7 +5753,7 @@ impl ::protobuf::Message for MintlayerTxOutput { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } - if let Some(v) = self.anyone_can_take.as_ref() { + if let Some(v) = self.create_order.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } @@ -5823,7 +5796,7 @@ impl ::protobuf::Message for MintlayerTxOutput { if let Some(v) = self.htlc.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(11, v, os)?; } - if let Some(v) = self.anyone_can_take.as_ref() { + if let Some(v) = self.create_order.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(12, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; @@ -5854,7 +5827,7 @@ impl ::protobuf::Message for MintlayerTxOutput { self.issue_nft.clear(); self.data_deposit.clear(); self.htlc.clear(); - self.anyone_can_take.clear(); + self.create_order.clear(); self.special_fields.clear(); } @@ -5871,7 +5844,7 @@ impl ::protobuf::Message for MintlayerTxOutput { issue_nft: ::protobuf::MessageField::none(), data_deposit: ::protobuf::MessageField::none(), htlc: ::protobuf::MessageField::none(), - anyone_can_take: ::protobuf::MessageField::none(), + create_order: ::protobuf::MessageField::none(), special_fields: ::protobuf::SpecialFields::new(), }; &instance @@ -5900,7 +5873,7 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerTxOutput { pub struct MintlayerTokenOutputValue { // message fields // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTokenOutputValue.token_id) - pub token_id: ::std::option::Option<::std::vec::Vec>, + pub token_id: ::std::option::Option<::std::string::String>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTokenOutputValue.token_ticker) pub token_ticker: ::std::option::Option<::std::vec::Vec>, // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTokenOutputValue.number_of_decimals) @@ -5921,12 +5894,12 @@ impl MintlayerTokenOutputValue { ::std::default::Default::default() } - // required bytes token_id = 1; + // required string token_id = 1; - pub fn token_id(&self) -> &[u8] { + pub fn token_id(&self) -> &str { match self.token_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -5939,22 +5912,22 @@ impl MintlayerTokenOutputValue { } // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + pub fn set_token_id(&mut self, v: ::std::string::String) { 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 { + pub fn mut_token_id(&mut self) -> &mut ::std::string::String { if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.token_id = ::std::option::Option::Some(::std::string::String::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()) + pub fn take_token_id(&mut self) -> ::std::string::String { + self.token_id.take().unwrap_or_else(|| ::std::string::String::new()) } // required bytes token_ticker = 2; @@ -6058,7 +6031,7 @@ impl ::protobuf::Message for MintlayerTokenOutputValue { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); + self.token_id = ::std::option::Option::Some(is.read_string()?); }, 18 => { self.token_ticker = ::std::option::Option::Some(is.read_bytes()?); @@ -6079,7 +6052,7 @@ impl ::protobuf::Message for MintlayerTokenOutputValue { 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::string_size(1, &v); } if let Some(v) = self.token_ticker.as_ref() { my_size += ::protobuf::rt::bytes_size(2, &v); @@ -6094,7 +6067,7 @@ impl ::protobuf::Message for MintlayerTokenOutputValue { 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_string(1, v)?; } if let Some(v) = self.token_ticker.as_ref() { os.write_bytes(2, v)?; @@ -6804,7 +6777,7 @@ impl MintlayerLockThenTransferTxOutput { ::std::default::Default::default() } - // optional string address = 1; + // required string address = 1; pub fn address(&self) -> &str { match self.address.as_ref() { @@ -6870,6 +6843,9 @@ impl ::protobuf::Message for MintlayerLockThenTransferTxOutput { const NAME: &'static str = "MintlayerLockThenTransferTxOutput"; fn is_initialized(&self) -> bool { + if self.address.is_none() { + return false; + } if self.value.is_none() { return false; } @@ -7126,7 +7102,7 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerBurnTxOutput { 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>, + pub pool_id: ::std::option::Option<::std::string::String>, // @@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) @@ -7155,12 +7131,12 @@ impl MintlayerCreateStakePoolTxOutput { ::std::default::Default::default() } - // required bytes pool_id = 1; + // required string pool_id = 1; - pub fn pool_id(&self) -> &[u8] { + pub fn pool_id(&self) -> &str { match self.pool_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -7173,22 +7149,22 @@ impl MintlayerCreateStakePoolTxOutput { } // Param is passed by value, moved - pub fn set_pool_id(&mut self, v: ::std::vec::Vec) { + pub fn set_pool_id(&mut self, v: ::std::string::String) { 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 { + pub fn mut_pool_id(&mut self) -> &mut ::std::string::String { if self.pool_id.is_none() { - self.pool_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.pool_id = ::std::option::Option::Some(::std::string::String::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()) + pub fn take_pool_id(&mut self) -> ::std::string::String { + self.pool_id.take().unwrap_or_else(|| ::std::string::String::new()) } // required bytes pledge = 2; @@ -7468,7 +7444,7 @@ impl ::protobuf::Message for MintlayerCreateStakePoolTxOutput { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - self.pool_id = ::std::option::Option::Some(is.read_bytes()?); + self.pool_id = ::std::option::Option::Some(is.read_string()?); }, 18 => { self.pledge = ::std::option::Option::Some(is.read_bytes()?); @@ -7501,7 +7477,7 @@ impl ::protobuf::Message for MintlayerCreateStakePoolTxOutput { 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); + my_size += ::protobuf::rt::string_size(1, &v); } if let Some(v) = self.pledge.as_ref() { my_size += ::protobuf::rt::bytes_size(2, &v); @@ -7528,7 +7504,7 @@ impl ::protobuf::Message for MintlayerCreateStakePoolTxOutput { 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)?; + os.write_string(1, v)?; } if let Some(v) = self.pledge.as_ref() { os.write_bytes(2, v)?; @@ -7614,7 +7590,7 @@ pub struct MintlayerProduceBlockFromStakeTxOutput { // @@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>, + pub pool_id: ::std::option::Option<::std::string::String>, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerProduceBlockFromStakeTxOutput.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -7667,12 +7643,12 @@ impl MintlayerProduceBlockFromStakeTxOutput { self.destination.take().unwrap_or_else(|| ::std::string::String::new()) } - // required bytes pool_id = 2; + // required string pool_id = 2; - pub fn pool_id(&self) -> &[u8] { + pub fn pool_id(&self) -> &str { match self.pool_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -7685,22 +7661,22 @@ impl MintlayerProduceBlockFromStakeTxOutput { } // Param is passed by value, moved - pub fn set_pool_id(&mut self, v: ::std::vec::Vec) { + pub fn set_pool_id(&mut self, v: ::std::string::String) { 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 { + pub fn mut_pool_id(&mut self) -> &mut ::std::string::String { if self.pool_id.is_none() { - self.pool_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.pool_id = ::std::option::Option::Some(::std::string::String::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()) + pub fn take_pool_id(&mut self) -> ::std::string::String { + self.pool_id.take().unwrap_or_else(|| ::std::string::String::new()) } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { @@ -7744,7 +7720,7 @@ impl ::protobuf::Message for MintlayerProduceBlockFromStakeTxOutput { self.destination = ::std::option::Option::Some(is.read_string()?); }, 18 => { - self.pool_id = ::std::option::Option::Some(is.read_bytes()?); + self.pool_id = ::std::option::Option::Some(is.read_string()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -7762,7 +7738,7 @@ impl ::protobuf::Message for MintlayerProduceBlockFromStakeTxOutput { 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::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); @@ -7774,7 +7750,7 @@ impl ::protobuf::Message for MintlayerProduceBlockFromStakeTxOutput { os.write_string(1, v)?; } if let Some(v) = self.pool_id.as_ref() { - os.write_bytes(2, v)?; + os.write_string(2, v)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -7832,7 +7808,7 @@ pub struct MintlayerCreateDelegationIdTxOutput { // @@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>, + pub pool_id: ::std::option::Option<::std::string::String>, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerCreateDelegationIdTxOutput.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -7885,12 +7861,12 @@ impl MintlayerCreateDelegationIdTxOutput { self.destination.take().unwrap_or_else(|| ::std::string::String::new()) } - // required bytes pool_id = 2; + // required string pool_id = 2; - pub fn pool_id(&self) -> &[u8] { + pub fn pool_id(&self) -> &str { match self.pool_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -7903,22 +7879,22 @@ impl MintlayerCreateDelegationIdTxOutput { } // Param is passed by value, moved - pub fn set_pool_id(&mut self, v: ::std::vec::Vec) { + pub fn set_pool_id(&mut self, v: ::std::string::String) { 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 { + pub fn mut_pool_id(&mut self) -> &mut ::std::string::String { if self.pool_id.is_none() { - self.pool_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.pool_id = ::std::option::Option::Some(::std::string::String::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()) + pub fn take_pool_id(&mut self) -> ::std::string::String { + self.pool_id.take().unwrap_or_else(|| ::std::string::String::new()) } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { @@ -7962,7 +7938,7 @@ impl ::protobuf::Message for MintlayerCreateDelegationIdTxOutput { self.destination = ::std::option::Option::Some(is.read_string()?); }, 18 => { - self.pool_id = ::std::option::Option::Some(is.read_bytes()?); + self.pool_id = ::std::option::Option::Some(is.read_string()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -7980,7 +7956,7 @@ impl ::protobuf::Message for MintlayerCreateDelegationIdTxOutput { 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::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); @@ -7992,7 +7968,7 @@ impl ::protobuf::Message for MintlayerCreateDelegationIdTxOutput { os.write_string(1, v)?; } if let Some(v) = self.pool_id.as_ref() { - os.write_bytes(2, v)?; + os.write_string(2, v)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -8050,7 +8026,7 @@ pub struct MintlayerDelegateStakingTxOutput { // @@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>, + pub delegation_id: ::std::option::Option<::std::string::String>, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerDelegateStakingTxOutput.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -8103,12 +8079,12 @@ impl MintlayerDelegateStakingTxOutput { self.amount.take().unwrap_or_else(|| ::std::vec::Vec::new()) } - // required bytes delegation_id = 2; + // required string delegation_id = 2; - pub fn delegation_id(&self) -> &[u8] { + pub fn delegation_id(&self) -> &str { match self.delegation_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -8121,22 +8097,22 @@ impl MintlayerDelegateStakingTxOutput { } // Param is passed by value, moved - pub fn set_delegation_id(&mut self, v: ::std::vec::Vec) { + pub fn set_delegation_id(&mut self, v: ::std::string::String) { 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 { + pub fn mut_delegation_id(&mut self) -> &mut ::std::string::String { if self.delegation_id.is_none() { - self.delegation_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.delegation_id = ::std::option::Option::Some(::std::string::String::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()) + pub fn take_delegation_id(&mut self) -> ::std::string::String { + self.delegation_id.take().unwrap_or_else(|| ::std::string::String::new()) } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { @@ -8180,7 +8156,7 @@ impl ::protobuf::Message for MintlayerDelegateStakingTxOutput { self.amount = ::std::option::Option::Some(is.read_bytes()?); }, 18 => { - self.delegation_id = ::std::option::Option::Some(is.read_bytes()?); + self.delegation_id = ::std::option::Option::Some(is.read_string()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -8198,7 +8174,7 @@ impl ::protobuf::Message for MintlayerDelegateStakingTxOutput { 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::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); @@ -8210,7 +8186,7 @@ impl ::protobuf::Message for MintlayerDelegateStakingTxOutput { os.write_bytes(1, v)?; } if let Some(v) = self.delegation_id.as_ref() { - os.write_bytes(2, v)?; + os.write_string(2, v)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -8849,7 +8825,7 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerIssueFungibleTokenTxOutput 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>, + pub token_id: ::std::option::Option<::std::string::String>, // @@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) @@ -8884,12 +8860,12 @@ impl MintlayerIssueNftTxOutput { ::std::default::Default::default() } - // required bytes token_id = 1; + // required string token_id = 1; - pub fn token_id(&self) -> &[u8] { + pub fn token_id(&self) -> &str { match self.token_id.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -8902,22 +8878,22 @@ impl MintlayerIssueNftTxOutput { } // Param is passed by value, moved - pub fn set_token_id(&mut self, v: ::std::vec::Vec) { + pub fn set_token_id(&mut self, v: ::std::string::String) { 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 { + pub fn mut_token_id(&mut self) -> &mut ::std::string::String { if self.token_id.is_none() { - self.token_id = ::std::option::Option::Some(::std::vec::Vec::new()); + self.token_id = ::std::option::Option::Some(::std::string::String::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()) + pub fn take_token_id(&mut self) -> ::std::string::String { + self.token_id.take().unwrap_or_else(|| ::std::string::String::new()) } // required string destination = 2; @@ -9334,7 +9310,7 @@ impl ::protobuf::Message for MintlayerIssueNftTxOutput { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { - self.token_id = ::std::option::Option::Some(is.read_bytes()?); + self.token_id = ::std::option::Option::Some(is.read_string()?); }, 18 => { self.destination = ::std::option::Option::Some(is.read_string()?); @@ -9376,7 +9352,7 @@ impl ::protobuf::Message for MintlayerIssueNftTxOutput { 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::string_size(1, &v); } if let Some(v) = self.destination.as_ref() { my_size += ::protobuf::rt::string_size(2, &v); @@ -9412,7 +9388,7 @@ impl ::protobuf::Message for MintlayerIssueNftTxOutput { 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_string(1, v)?; } if let Some(v) = self.destination.as_ref() { os.write_string(2, v)?; @@ -9996,29 +9972,29 @@ impl ::protobuf::reflect::ProtobufValue for MintlayerHtlcTxOutput { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerAnyoneCanTakeTxOutput) +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerCreateOrderTxOutput) #[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerAnyoneCanTakeTxOutput { +pub struct MintlayerCreateOrderTxOutput { // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAnyoneCanTakeTxOutput.conclude_key) + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateOrderTxOutput.conclude_key) pub conclude_key: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAnyoneCanTakeTxOutput.ask) + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateOrderTxOutput.ask) pub ask: ::protobuf::MessageField, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerAnyoneCanTakeTxOutput.give) + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerCreateOrderTxOutput.give) pub give: ::protobuf::MessageField, // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerAnyoneCanTakeTxOutput.special_fields) + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerCreateOrderTxOutput.special_fields) pub special_fields: ::protobuf::SpecialFields, } -impl<'a> ::std::default::Default for &'a MintlayerAnyoneCanTakeTxOutput { - fn default() -> &'a MintlayerAnyoneCanTakeTxOutput { - ::default_instance() +impl<'a> ::std::default::Default for &'a MintlayerCreateOrderTxOutput { + fn default() -> &'a MintlayerCreateOrderTxOutput { + ::default_instance() } } -impl MintlayerAnyoneCanTakeTxOutput { - pub fn new() -> MintlayerAnyoneCanTakeTxOutput { +impl MintlayerCreateOrderTxOutput { + pub fn new() -> MintlayerCreateOrderTxOutput { ::std::default::Default::default() } @@ -10063,29 +10039,29 @@ impl MintlayerAnyoneCanTakeTxOutput { let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( "conclude_key", - |m: &MintlayerAnyoneCanTakeTxOutput| { &m.conclude_key }, - |m: &mut MintlayerAnyoneCanTakeTxOutput| { &mut m.conclude_key }, + |m: &MintlayerCreateOrderTxOutput| { &m.conclude_key }, + |m: &mut MintlayerCreateOrderTxOutput| { &mut m.conclude_key }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( "ask", - |m: &MintlayerAnyoneCanTakeTxOutput| { &m.ask }, - |m: &mut MintlayerAnyoneCanTakeTxOutput| { &mut m.ask }, + |m: &MintlayerCreateOrderTxOutput| { &m.ask }, + |m: &mut MintlayerCreateOrderTxOutput| { &mut m.ask }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( "give", - |m: &MintlayerAnyoneCanTakeTxOutput| { &m.give }, - |m: &mut MintlayerAnyoneCanTakeTxOutput| { &mut m.give }, + |m: &MintlayerCreateOrderTxOutput| { &m.give }, + |m: &mut MintlayerCreateOrderTxOutput| { &mut m.give }, )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerAnyoneCanTakeTxOutput", + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerCreateOrderTxOutput", fields, oneofs, ) } } -impl ::protobuf::Message for MintlayerAnyoneCanTakeTxOutput { - const NAME: &'static str = "MintlayerAnyoneCanTakeTxOutput"; +impl ::protobuf::Message for MintlayerCreateOrderTxOutput { + const NAME: &'static str = "MintlayerCreateOrderTxOutput"; fn is_initialized(&self) -> bool { if self.conclude_key.is_none() { @@ -10172,8 +10148,8 @@ impl ::protobuf::Message for MintlayerAnyoneCanTakeTxOutput { &mut self.special_fields } - fn new() -> MintlayerAnyoneCanTakeTxOutput { - MintlayerAnyoneCanTakeTxOutput::new() + fn new() -> MintlayerCreateOrderTxOutput { + MintlayerCreateOrderTxOutput::new() } fn clear(&mut self) { @@ -10183,8 +10159,8 @@ impl ::protobuf::Message for MintlayerAnyoneCanTakeTxOutput { self.special_fields.clear(); } - fn default_instance() -> &'static MintlayerAnyoneCanTakeTxOutput { - static instance: MintlayerAnyoneCanTakeTxOutput = MintlayerAnyoneCanTakeTxOutput { + fn default_instance() -> &'static MintlayerCreateOrderTxOutput { + static instance: MintlayerCreateOrderTxOutput = MintlayerCreateOrderTxOutput { conclude_key: ::std::option::Option::None, ask: ::protobuf::MessageField::none(), give: ::protobuf::MessageField::none(), @@ -10194,159 +10170,81 @@ impl ::protobuf::Message for MintlayerAnyoneCanTakeTxOutput { } } -impl ::protobuf::MessageFull for MintlayerAnyoneCanTakeTxOutput { +impl ::protobuf::MessageFull for MintlayerCreateOrderTxOutput { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerAnyoneCanTakeTxOutput").unwrap()).clone() + descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerCreateOrderTxOutput").unwrap()).clone() } } -impl ::std::fmt::Display for MintlayerAnyoneCanTakeTxOutput { +impl ::std::fmt::Display for MintlayerCreateOrderTxOutput { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } -impl ::protobuf::reflect::ProtobufValue for MintlayerAnyoneCanTakeTxOutput { +impl ::protobuf::reflect::ProtobufValue for MintlayerCreateOrderTxOutput { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerPrevTx) +// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput) #[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerPrevTx { +pub struct MintlayerTxAckUtxoInput { // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevTx.version) - pub version: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevTx.inputs_count) - pub inputs_count: ::std::option::Option, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevTx.outputs_count) - pub outputs_count: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.tx) + pub tx: ::protobuf::MessageField, // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerPrevTx.special_fields) + // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.special_fields) pub special_fields: ::protobuf::SpecialFields, } -impl<'a> ::std::default::Default for &'a MintlayerPrevTx { - fn default() -> &'a MintlayerPrevTx { - ::default_instance() +impl<'a> ::std::default::Default for &'a MintlayerTxAckUtxoInput { + fn default() -> &'a MintlayerTxAckUtxoInput { + ::default_instance() } } -impl MintlayerPrevTx { - pub fn new() -> MintlayerPrevTx { +impl MintlayerTxAckUtxoInput { + pub fn new() -> MintlayerTxAckUtxoInput { ::std::default::Default::default() } - // required uint32 version = 1; - - pub fn version(&self) -> u32 { - self.version.unwrap_or(0) - } - - pub fn clear_version(&mut self) { - self.version = ::std::option::Option::None; - } - - pub fn has_version(&self) -> bool { - self.version.is_some() - } - - // Param is passed by value, moved - pub fn set_version(&mut self, v: u32) { - self.version = ::std::option::Option::Some(v); - } - - // required uint32 inputs_count = 6; - - pub fn inputs_count(&self) -> u32 { - self.inputs_count.unwrap_or(0) - } - - pub fn clear_inputs_count(&mut self) { - self.inputs_count = ::std::option::Option::None; - } - - pub fn has_inputs_count(&self) -> bool { - self.inputs_count.is_some() - } - - // Param is passed by value, moved - pub fn set_inputs_count(&mut self, v: u32) { - self.inputs_count = ::std::option::Option::Some(v); - } - - // required uint32 outputs_count = 7; - - pub fn outputs_count(&self) -> u32 { - self.outputs_count.unwrap_or(0) - } - - pub fn clear_outputs_count(&mut self) { - self.outputs_count = ::std::option::Option::None; - } - - pub fn has_outputs_count(&self) -> bool { - self.outputs_count.is_some() - } - - // Param is passed by value, moved - pub fn set_outputs_count(&mut self, v: u32) { - self.outputs_count = ::std::option::Option::Some(v); - } - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); + let mut 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::<_, _>( - "version", - |m: &MintlayerPrevTx| { &m.version }, - |m: &mut MintlayerPrevTx| { &mut m.version }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "inputs_count", - |m: &MintlayerPrevTx| { &m.inputs_count }, - |m: &mut MintlayerPrevTx| { &mut m.inputs_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "outputs_count", - |m: &MintlayerPrevTx| { &m.outputs_count }, - |m: &mut MintlayerPrevTx| { &mut m.outputs_count }, + fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, mintlayer_tx_ack_utxo_input::MintlayerTxAckInputWrapper>( + "tx", + |m: &MintlayerTxAckUtxoInput| { &m.tx }, + |m: &mut MintlayerTxAckUtxoInput| { &mut m.tx }, )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerPrevTx", + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "MintlayerTxAckUtxoInput", fields, oneofs, ) } } -impl ::protobuf::Message for MintlayerPrevTx { - const NAME: &'static str = "MintlayerPrevTx"; +impl ::protobuf::Message for MintlayerTxAckUtxoInput { + const NAME: &'static str = "MintlayerTxAckUtxoInput"; fn is_initialized(&self) -> bool { - if self.version.is_none() { - return false; - } - if self.inputs_count.is_none() { - return false; - } - if self.outputs_count.is_none() { + if self.tx.is_none() { return false; } + for v in &self.tx { + if !v.is_initialized() { + return false; + } + }; true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { - 8 => { - self.version = ::std::option::Option::Some(is.read_uint32()?); - }, - 48 => { - self.inputs_count = ::std::option::Option::Some(is.read_uint32()?); - }, - 56 => { - self.outputs_count = ::std::option::Option::Some(is.read_uint32()?); + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -10360,14 +10258,9 @@ impl ::protobuf::Message for MintlayerPrevTx { #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; - if let Some(v) = self.version { - my_size += ::protobuf::rt::uint32_size(1, v); - } - if let Some(v) = self.inputs_count { - my_size += ::protobuf::rt::uint32_size(6, v); - } - if let Some(v) = self.outputs_count { - my_size += ::protobuf::rt::uint32_size(7, v); + if let Some(v) = self.tx.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); @@ -10375,14 +10268,8 @@ impl ::protobuf::Message for MintlayerPrevTx { } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.version { - os.write_uint32(1, v)?; - } - if let Some(v) = self.inputs_count { - os.write_uint32(6, v)?; - } - if let Some(v) = self.outputs_count { - os.write_uint32(7, v)?; + if let Some(v) = self.tx.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -10396,479 +10283,12 @@ impl ::protobuf::Message for MintlayerPrevTx { &mut self.special_fields } - fn new() -> MintlayerPrevTx { - MintlayerPrevTx::new() + fn new() -> MintlayerTxAckUtxoInput { + MintlayerTxAckUtxoInput::new() } fn clear(&mut self) { - self.version = ::std::option::Option::None; - self.inputs_count = ::std::option::Option::None; - self.outputs_count = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerPrevTx { - static instance: MintlayerPrevTx = MintlayerPrevTx { - version: ::std::option::Option::None, - inputs_count: ::std::option::Option::None, - outputs_count: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerPrevTx { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerPrevTx").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerPrevTx { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerPrevTx { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerPrevInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerPrevInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevInput.prev_hash) - pub prev_hash: ::std::option::Option<::std::vec::Vec>, - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevInput.prev_index) - pub prev_index: ::std::option::Option, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerPrevInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerPrevInput { - fn default() -> &'a MintlayerPrevInput { - ::default_instance() - } -} - -impl MintlayerPrevInput { - pub fn new() -> MintlayerPrevInput { - ::std::default::Default::default() - } - - // required bytes prev_hash = 2; - - pub fn prev_hash(&self) -> &[u8] { - match self.prev_hash.as_ref() { - Some(v) => v, - None => &[], - } - } - - pub fn clear_prev_hash(&mut self) { - self.prev_hash = ::std::option::Option::None; - } - - pub fn has_prev_hash(&self) -> bool { - self.prev_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_hash(&mut self, v: ::std::vec::Vec) { - self.prev_hash = ::std::option::Option::Some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_prev_hash(&mut self) -> &mut ::std::vec::Vec { - if self.prev_hash.is_none() { - self.prev_hash = ::std::option::Option::Some(::std::vec::Vec::new()); - } - self.prev_hash.as_mut().unwrap() - } - - // Take field - pub fn take_prev_hash(&mut self) -> ::std::vec::Vec { - self.prev_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint32 prev_index = 3; - - pub fn prev_index(&self) -> u32 { - self.prev_index.unwrap_or(0) - } - - pub fn clear_prev_index(&mut self) { - self.prev_index = ::std::option::Option::None; - } - - pub fn has_prev_index(&self) -> bool { - self.prev_index.is_some() - } - - // Param is passed by value, moved - pub fn set_prev_index(&mut self, v: u32) { - self.prev_index = ::std::option::Option::Some(v); - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_hash", - |m: &MintlayerPrevInput| { &m.prev_hash }, - |m: &mut MintlayerPrevInput| { &mut m.prev_hash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "prev_index", - |m: &MintlayerPrevInput| { &m.prev_index }, - |m: &mut MintlayerPrevInput| { &mut m.prev_index }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerPrevInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerPrevInput { - const NAME: &'static str = "MintlayerPrevInput"; - - fn is_initialized(&self) -> bool { - if self.prev_hash.is_none() { - return false; - } - if self.prev_index.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 18 => { - self.prev_hash = ::std::option::Option::Some(is.read_bytes()?); - }, - 24 => { - self.prev_index = ::std::option::Option::Some(is.read_uint32()?); - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.prev_hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.prev_index { - my_size += ::protobuf::rt::uint32_size(3, v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.prev_hash.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.prev_index { - os.write_uint32(3, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerPrevInput { - MintlayerPrevInput::new() - } - - fn clear(&mut self) { - self.prev_hash = ::std::option::Option::None; - self.prev_index = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerPrevInput { - static instance: MintlayerPrevInput = MintlayerPrevInput { - prev_hash: ::std::option::Option::None, - prev_index: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerPrevInput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerPrevInput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerPrevInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerPrevInput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerPrevTransferOutput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerPrevTransferOutput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerPrevTransferOutput.value) - pub value: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerPrevTransferOutput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerPrevTransferOutput { - fn default() -> &'a MintlayerPrevTransferOutput { - ::default_instance() - } -} - -impl MintlayerPrevTransferOutput { - pub fn new() -> MintlayerPrevTransferOutput { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MintlayerOutputValue>( - "value", - |m: &MintlayerPrevTransferOutput| { &m.value }, - |m: &mut MintlayerPrevTransferOutput| { &mut m.value }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerPrevTransferOutput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerPrevTransferOutput { - const NAME: &'static str = "MintlayerPrevTransferOutput"; - - fn is_initialized(&self) -> bool { - if self.value.is_none() { - return false; - } - for v in &self.value { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.value)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.value.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.value.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerPrevTransferOutput { - MintlayerPrevTransferOutput::new() - } - - fn clear(&mut self) { - self.value.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MintlayerPrevTransferOutput { - static instance: MintlayerPrevTransferOutput = MintlayerPrevTransferOutput { - value: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MintlayerPrevTransferOutput { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MintlayerPrevTransferOutput").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MintlayerPrevTransferOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MintlayerPrevTransferOutput { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -// @@protoc_insertion_point(message:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MintlayerTxAckUtxoInput { - // message fields - // @@protoc_insertion_point(field:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.tx) - pub tx: ::protobuf::MessageField, - // special fields - // @@protoc_insertion_point(special_field:hw.trezor.messages.mintlayer.MintlayerTxAckUtxoInput.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MintlayerTxAckUtxoInput { - fn default() -> &'a MintlayerTxAckUtxoInput { - ::default_instance() - } -} - -impl MintlayerTxAckUtxoInput { - pub fn new() -> MintlayerTxAckUtxoInput { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, mintlayer_tx_ack_utxo_input::MintlayerTxAckInputWrapper>( - "tx", - |m: &MintlayerTxAckUtxoInput| { &m.tx }, - |m: &mut MintlayerTxAckUtxoInput| { &mut m.tx }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MintlayerTxAckUtxoInput", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MintlayerTxAckUtxoInput { - const NAME: &'static str = "MintlayerTxAckUtxoInput"; - - fn is_initialized(&self) -> bool { - if self.tx.is_none() { - return false; - } - for v in &self.tx { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 10 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.tx)?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if let Some(v) = self.tx.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.tx.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MintlayerTxAckUtxoInput { - MintlayerTxAckUtxoInput::new() - } - - fn clear(&mut self) { - self.tx.clear(); + self.tx.clear(); self.special_fields.clear(); } @@ -10956,7 +10376,7 @@ pub mod mintlayer_tx_ack_utxo_input { fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { - 18 => { + 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.input)?; }, tag => { @@ -10982,7 +10402,7 @@ pub mod mintlayer_tx_ack_utxo_input { fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.input.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -11221,7 +10641,7 @@ pub mod mintlayer_tx_ack_output { fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { - 42 => { + 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.output)?; }, tag => { @@ -11247,7 +10667,7 @@ pub mod mintlayer_tx_ack_output { fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.output.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -11466,157 +10886,148 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \x01(\x0b2<.hw.trezor.messages.mintlayer.MintlayerAccountCommandTxInputR\ \x0eaccountCommand\"V\n\x14MintlayerAddressPath\x12\x1b\n\taddress_n\x18\ \x01\x20\x03(\rR\x08addressN\x12!\n\x0cmultisig_idx\x18\x02\x20\x01(\rR\ - \x0bmultisigIdx\"\xf4\x02\n\x14MintlayerUtxoTxInput\x12O\n\taddress_n\ + \x0bmultisigIdx\"\xaa\x02\n\x14MintlayerUtxoTxInput\x12O\n\taddress_n\ \x18\x01\x20\x03(\x0b22.hw.trezor.messages.mintlayer.MintlayerAddressPat\ hR\x08addressN\x12\x18\n\x07address\x18\x02\x20\x02(\tR\x07address\x12\ \x1b\n\tprev_hash\x18\x03\x20\x02(\x0cR\x08prevHash\x12\x1d\n\nprev_inde\ x\x18\x04\x20\x02(\rR\tprevIndex\x12C\n\x04type\x18\x05\x20\x02(\x0e2/.h\ w.trezor.messages.mintlayer.MintlayerUtxoTypeR\x04type\x12&\n\x08sequenc\ - e\x18\x06\x20\x01(\r:\n4294967295R\x08sequence\x12H\n\x05value\x18\x07\ - \x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValueR\x05va\ - lue\"\xb1\x02\n\x17MintlayerAccountTxInput\x12O\n\taddress_n\x18\x01\x20\ - \x03(\x0b22.hw.trezor.messages.mintlayer.MintlayerAddressPathR\x08addres\ - sN\x12\x18\n\x07address\x18\x02\x20\x02(\tR\x07address\x12&\n\x08sequenc\ - e\x18\x03\x20\x01(\r:\n4294967295R\x08sequence\x12H\n\x05value\x18\x04\ - \x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValueR\x05va\ - lue\x12\x14\n\x05nonce\x18\x05\x20\x02(\x04R\x05nonce\x12#\n\rdelegation\ - _id\x18\x06\x20\x02(\x0cR\x0cdelegationId\"\x90\x08\n\x1eMintlayerAccoun\ - tCommandTxInput\x12O\n\taddress_n\x18\x01\x20\x03(\x0b22.hw.trezor.messa\ - ges.mintlayer.MintlayerAddressPathR\x08addressN\x12\x18\n\x07address\x18\ + e\x18\x06\x20\x01(\r:\n4294967295R\x08sequence\"\xb1\x02\n\x17MintlayerA\ + ccountTxInput\x12O\n\taddress_n\x18\x01\x20\x03(\x0b22.hw.trezor.message\ + s.mintlayer.MintlayerAddressPathR\x08addressN\x12\x18\n\x07address\x18\ \x02\x20\x02(\tR\x07address\x12&\n\x08sequence\x18\x03\x20\x01(\r:\n4294\ - 967295R\x08sequence\x12\x14\n\x05nonce\x18\x04\x20\x02(\x04R\x05nonce\ - \x12E\n\x04mint\x18\x05\x20\x01(\x0b21.hw.trezor.messages.mintlayer.Mint\ - layerMintTokensR\x04mint\x12K\n\x06unmint\x18\x06\x20\x01(\x0b23.hw.trez\ - or.messages.mintlayer.MintlayerUnmintTokensR\x06unmint\x12b\n\x11lock_to\ - ken_supply\x18\x07\x20\x01(\x0b26.hw.trezor.messages.mintlayer.Mintlayer\ - LockTokenSupplyR\x0flockTokenSupply\x12U\n\x0cfreeze_token\x18\x08\x20\ - \x01(\x0b22.hw.trezor.messages.mintlayer.MintlayerFreezeTokenR\x0bfreeze\ - Token\x12[\n\x0eunfreeze_token\x18\t\x20\x01(\x0b24.hw.trezor.messages.m\ - intlayer.MintlayerUnfreezeTokenR\runfreezeToken\x12q\n\x16change_token_a\ - uthority\x18\n\x20\x01(\x0b2;.hw.trezor.messages.mintlayer.MintlayerChan\ - geTokenAuhtorityR\x14changeTokenAuthority\x12[\n\x0econclude_order\x18\ - \x0b\x20\x01(\x0b24.hw.trezor.messages.mintlayer.MintlayerConcludeOrderR\ - \rconcludeOrder\x12O\n\nfill_order\x18\x0c\x20\x01(\x0b20.hw.trezor.mess\ - ages.mintlayer.MintlayerFillOrderR\tfillOrder\x12x\n\x19change_token_met\ - adata_uri\x18\r\x20\x01(\x0b2=.hw.trezor.messages.mintlayer.MintlayerCha\ - ngeTokenMetadataUriR\x16changeTokenMetadataUri\"H\n\x13MintlayerMintToke\ - ns\x12\x19\n\x08token_id\x18\x01\x20\x02(\x0cR\x07tokenId\x12\x16\n\x06a\ - mount\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\"3\n\x16MintlayerConcludeOrder\x12\ - \x19\n\x08order_id\x18\x01\x20\x02(\x0cR\x07orderId\"i\n\x12MintlayerFil\ - lOrder\x12\x19\n\x08order_id\x18\x01\x20\x02(\x0cR\x07orderId\x12\x16\n\ - \x06amount\x18\x02\x20\x02(\x0cR\x06amount\x12\x20\n\x0bdestination\x18\ - \x03\x20\x02(\tR\x0bdestination\"_\n\x1fMintlayerChangeTokenMetadataUri\ - \x12\x19\n\x08token_id\x18\x01\x20\x02(\x0cR\x07tokenId\x12!\n\x0cmetada\ - ta_uri\x18\x02\x20\x02(\x0cR\x0bmetadataUri\"\xc4\t\n\x11MintlayerTxOutp\ - ut\x12S\n\x08transfer\x18\x01\x20\x01(\x0b27.hw.trezor.messages.mintlaye\ - r.MintlayerTransferTxOutputR\x08transfer\x12m\n\x12lock_then_transfer\ - \x18\x02\x20\x01(\x0b2?.hw.trezor.messages.mintlayer.MintlayerLockThenTr\ - ansferTxOutputR\x10lockThenTransfer\x12G\n\x04burn\x18\x03\x20\x01(\x0b2\ - 3.hw.trezor.messages.mintlayer.MintlayerBurnTxOutputR\x04burn\x12j\n\x11\ - create_stake_pool\x18\x04\x20\x01(\x0b2>.hw.trezor.messages.mintlayer.Mi\ - ntlayerCreateStakePoolTxOutputR\x0fcreateStakePool\x12}\n\x18produce_blo\ - ck_from_stake\x18\x05\x20\x01(\x0b2D.hw.trezor.messages.mintlayer.Mintla\ - yerProduceBlockFromStakeTxOutputR\x15produceBlockFromStake\x12s\n\x14cre\ - ate_delegation_id\x18\x06\x20\x01(\x0b2A.hw.trezor.messages.mintlayer.Mi\ - ntlayerCreateDelegationIdTxOutputR\x12createDelegationId\x12i\n\x10deleg\ - ate_staking\x18\x07\x20\x01(\x0b2>.hw.trezor.messages.mintlayer.Mintlaye\ - rDelegateStakingTxOutputR\x0fdelegateStaking\x12s\n\x14issue_fungible_to\ - ken\x18\x08\x20\x01(\x0b2A.hw.trezor.messages.mintlayer.MintlayerIssueFu\ - ngibleTokenTxOutputR\x12issueFungibleToken\x12T\n\tissue_nft\x18\t\x20\ - \x01(\x0b27.hw.trezor.messages.mintlayer.MintlayerIssueNftTxOutputR\x08i\ - ssueNft\x12]\n\x0cdata_deposit\x18\n\x20\x01(\x0b2:.hw.trezor.messages.m\ - intlayer.MintlayerDataDepositTxOutputR\x0bdataDeposit\x12G\n\x04htlc\x18\ - \x0b\x20\x01(\x0b23.hw.trezor.messages.mintlayer.MintlayerHtlcTxOutputR\ - \x04htlc\x12d\n\x0fanyone_can_take\x18\x0c\x20\x01(\x0b2<.hw.trezor.mess\ - ages.mintlayer.MintlayerAnyoneCanTakeTxOutputR\ranyoneCanTake\"\x87\x01\ - \n\x19MintlayerTokenOutputValue\x12\x19\n\x08token_id\x18\x01\x20\x02(\ - \x0cR\x07tokenId\x12!\n\x0ctoken_ticker\x18\x02\x20\x02(\x0cR\x0btokenTi\ - cker\x12,\n\x12number_of_decimals\x18\x03\x20\x02(\rR\x10numberOfDecimal\ - s\"}\n\x14MintlayerOutputValue\x12\x16\n\x06amount\x18\x01\x20\x02(\x0cR\ - \x06amount\x12M\n\x05token\x18\x02\x20\x01(\x0b27.hw.trezor.messages.min\ - tlayer.MintlayerTokenOutputValueR\x05token\"\x7f\n\x19MintlayerTransferT\ - xOutput\x12\x18\n\x07address\x18\x01\x20\x02(\tR\x07address\x12H\n\x05va\ - lue\x18\x02\x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputV\ - alueR\x05value\"\xa4\x01\n\x17MintlayerOutputTimeLock\x12!\n\x0cuntil_he\ - ight\x18\x01\x20\x01(\x04R\x0buntilHeight\x12\x1d\n\nuntil_time\x18\x02\ - \x20\x01(\x04R\tuntilTime\x12&\n\x0ffor_block_count\x18\x03\x20\x01(\x04\ - R\rforBlockCount\x12\x1f\n\x0bfor_seconds\x18\x04\x20\x01(\x04R\nforSeco\ - nds\"\xd2\x01\n!MintlayerLockThenTransferTxOutput\x12\x18\n\x07address\ - \x18\x01\x20\x01(\tR\x07address\x12H\n\x05value\x18\x02\x20\x02(\x0b22.h\ - w.trezor.messages.mintlayer.MintlayerOutputValueR\x05value\x12I\n\x04loc\ - k\x18\x03\x20\x02(\x0b25.hw.trezor.messages.mintlayer.MintlayerOutputTim\ - eLockR\x04lock\"a\n\x15MintlayerBurnTxOutput\x12H\n\x05value\x18\x01\x20\ - \x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValueR\x05value\ - \"\x9d\x02\n\x20MintlayerCreateStakePoolTxOutput\x12\x17\n\x07pool_id\ - \x18\x01\x20\x02(\x0cR\x06poolId\x12\x16\n\x06pledge\x18\x02\x20\x02(\ - \x0cR\x06pledge\x12\x16\n\x06staker\x18\x03\x20\x02(\tR\x06staker\x12$\n\ - \x0evrf_public_key\x18\x04\x20\x02(\tR\x0cvrfPublicKey\x12)\n\x10decommi\ - ssion_key\x18\x05\x20\x02(\tR\x0fdecommissionKey\x129\n\x19margin_ratio_\ - per_thousand\x18\x06\x20\x02(\rR\x16marginRatioPerThousand\x12$\n\x0ecos\ - t_per_block\x18\x07\x20\x02(\x0cR\x0ccostPerBlock\"c\n&MintlayerProduceB\ - lockFromStakeTxOutput\x12\x20\n\x0bdestination\x18\x01\x20\x02(\tR\x0bde\ - stination\x12\x17\n\x07pool_id\x18\x02\x20\x02(\x0cR\x06poolId\"`\n#Mint\ - layerCreateDelegationIdTxOutput\x12\x20\n\x0bdestination\x18\x01\x20\x02\ - (\tR\x0bdestination\x12\x17\n\x07pool_id\x18\x02\x20\x02(\x0cR\x06poolId\ - \"_\n\x20MintlayerDelegateStakingTxOutput\x12\x16\n\x06amount\x18\x01\ - \x20\x02(\x0cR\x06amount\x12#\n\rdelegation_id\x18\x02\x20\x02(\x0cR\x0c\ - delegationId\"\x8f\x01\n\x19MintlayerTokenTotalSupply\x12O\n\x04type\x18\ - \x01\x20\x02(\x0e2;.hw.trezor.messages.mintlayer.MintlayerTokenTotalSupp\ - lyTypeR\x04type\x12!\n\x0cfixed_amount\x18\x02\x20\x01(\x0cR\x0bfixedAmo\ - unt\"\xb6\x02\n#MintlayerIssueFungibleTokenTxOutput\x12!\n\x0ctoken_tick\ - er\x18\x01\x20\x02(\x0cR\x0btokenTicker\x12,\n\x12number_of_decimals\x18\ - \x02\x20\x02(\rR\x10numberOfDecimals\x12!\n\x0cmetadata_uri\x18\x03\x20\ - \x02(\x0cR\x0bmetadataUri\x12Z\n\x0ctotal_supply\x18\x04\x20\x02(\x0b27.\ - hw.trezor.messages.mintlayer.MintlayerTokenTotalSupplyR\x0btotalSupply\ - \x12\x1c\n\tauthority\x18\x05\x20\x02(\tR\tauthority\x12!\n\x0cis_freeza\ - ble\x18\x06\x20\x02(\x08R\x0bisFreezable\"\xcf\x02\n\x19MintlayerIssueNf\ - tTxOutput\x12\x19\n\x08token_id\x18\x01\x20\x02(\x0cR\x07tokenId\x12\x20\ - \n\x0bdestination\x18\x02\x20\x02(\tR\x0bdestination\x12\x18\n\x07creato\ - r\x18\x03\x20\x01(\tR\x07creator\x12\x12\n\x04name\x18\x04\x20\x02(\x0cR\ - \x04name\x12\x20\n\x0bdescription\x18\x05\x20\x02(\x0cR\x0bdescription\ - \x12\x16\n\x06ticker\x18\x06\x20\x02(\x0cR\x06ticker\x12\x19\n\x08icon_u\ - ri\x18\x07\x20\x01(\x0cR\x07iconUri\x126\n\x17additional_metadata_uri\ - \x18\x08\x20\x01(\x0cR\x15additionalMetadataUri\x12\x1b\n\tmedia_uri\x18\ - \t\x20\x01(\x0cR\x08mediaUri\x12\x1d\n\nmedia_hash\x18\n\x20\x02(\x0cR\t\ - mediaHash\"2\n\x1cMintlayerDataDepositTxOutput\x12\x12\n\x04data\x18\x01\ - \x20\x02(\x0cR\x04data\"\x9e\x02\n\x15MintlayerHtlcTxOutput\x12H\n\x05va\ - lue\x18\x01\x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputV\ - alueR\x05value\x12\x1f\n\x0bsecret_hash\x18\x02\x20\x02(\x0cR\nsecretHas\ - h\x12\x1b\n\tspend_key\x18\x03\x20\x02(\tR\x08spendKey\x12^\n\x0frefund_\ - timelock\x18\x04\x20\x02(\x0b25.hw.trezor.messages.mintlayer.MintlayerOu\ - tputTimeLockR\x0erefundTimelock\x12\x1d\n\nrefund_key\x18\x05\x20\x02(\t\ - R\trefundKey\"\xd1\x01\n\x1eMintlayerAnyoneCanTakeTxOutput\x12!\n\x0ccon\ - clude_key\x18\x01\x20\x02(\tR\x0bconcludeKey\x12D\n\x03ask\x18\x02\x20\ - \x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValueR\x03ask\ - \x12F\n\x04give\x18\x03\x20\x02(\x0b22.hw.trezor.messages.mintlayer.Mint\ - layerOutputValueR\x04give\"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\"g\n\x1bM\ - intlayerPrevTransferOutput\x12H\n\x05value\x18\x01\x20\x02(\x0b22.hw.tre\ - zor.messages.mintlayer.MintlayerOutputValueR\x05value\"\xdf\x01\n\x17Min\ - tlayerTxAckUtxoInput\x12`\n\x02tx\x18\x01\x20\x02(\x0b2P.hw.trezor.messa\ - ges.mintlayer.MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapperR\x02tx\ - \x1ab\n\x1aMintlayerTxAckInputWrapper\x12D\n\x05input\x18\x02\x20\x02(\ - \x0b2..hw.trezor.messages.mintlayer.MintlayerTxInputR\x05input\"\xde\x01\ - \n\x14MintlayerTxAckOutput\x12^\n\x02tx\x18\x01\x20\x02(\x0b2N.hw.trezor\ - .messages.mintlayer.MintlayerTxAckOutput.MintlayerTxAckOutputWrapperR\ - \x02tx\x1af\n\x1bMintlayerTxAckOutputWrapper\x12G\n\x06output\x18\x05\ - \x20\x02(\x0b2/.hw.trezor.messages.mintlayer.MintlayerTxOutputR\x06outpu\ - t*/\n\x11MintlayerUtxoType\x12\x0f\n\x0bTRANSACTION\x10\0\x12\t\n\x05BLO\ - CK\x10\x01*G\n\x1dMintlayerTokenTotalSupplyType\x12\t\n\x05FIXED\x10\0\ - \x12\x0c\n\x08LOCKABLE\x10\x01\x12\r\n\tUNLIMITED\x10\x02B=\n#com.satosh\ - ilabs.trezor.lib.protobufB\x16TrezorMessageMintlayer\ + 967295R\x08sequence\x12H\n\x05value\x18\x04\x20\x02(\x0b22.hw.trezor.mes\ + sages.mintlayer.MintlayerOutputValueR\x05value\x12\x14\n\x05nonce\x18\ + \x05\x20\x02(\x04R\x05nonce\x12#\n\rdelegation_id\x18\x06\x20\x02(\tR\ + \x0cdelegationId\"\x90\x08\n\x1eMintlayerAccountCommandTxInput\x12O\n\ta\ + ddress_n\x18\x01\x20\x03(\x0b22.hw.trezor.messages.mintlayer.MintlayerAd\ + dressPathR\x08addressN\x12\x18\n\x07address\x18\x02\x20\x02(\tR\x07addre\ + ss\x12&\n\x08sequence\x18\x03\x20\x01(\r:\n4294967295R\x08sequence\x12\ + \x14\n\x05nonce\x18\x04\x20\x02(\x04R\x05nonce\x12E\n\x04mint\x18\x05\ + \x20\x01(\x0b21.hw.trezor.messages.mintlayer.MintlayerMintTokensR\x04min\ + t\x12K\n\x06unmint\x18\x06\x20\x01(\x0b23.hw.trezor.messages.mintlayer.M\ + intlayerUnmintTokensR\x06unmint\x12b\n\x11lock_token_supply\x18\x07\x20\ + \x01(\x0b26.hw.trezor.messages.mintlayer.MintlayerLockTokenSupplyR\x0flo\ + ckTokenSupply\x12U\n\x0cfreeze_token\x18\x08\x20\x01(\x0b22.hw.trezor.me\ + ssages.mintlayer.MintlayerFreezeTokenR\x0bfreezeToken\x12[\n\x0eunfreeze\ + _token\x18\t\x20\x01(\x0b24.hw.trezor.messages.mintlayer.MintlayerUnfree\ + zeTokenR\runfreezeToken\x12q\n\x16change_token_authority\x18\n\x20\x01(\ + \x0b2;.hw.trezor.messages.mintlayer.MintlayerChangeTokenAuhtorityR\x14ch\ + angeTokenAuthority\x12[\n\x0econclude_order\x18\x0b\x20\x01(\x0b24.hw.tr\ + ezor.messages.mintlayer.MintlayerConcludeOrderR\rconcludeOrder\x12O\n\nf\ + ill_order\x18\x0c\x20\x01(\x0b20.hw.trezor.messages.mintlayer.MintlayerF\ + illOrderR\tfillOrder\x12x\n\x19change_token_metadata_uri\x18\r\x20\x01(\ + \x0b2=.hw.trezor.messages.mintlayer.MintlayerChangeTokenMetadataUriR\x16\ + changeTokenMetadataUri\"H\n\x13MintlayerMintTokens\x12\x19\n\x08token_id\ + \x18\x01\x20\x02(\tR\x07tokenId\x12\x16\n\x06amount\x18\x02\x20\x02(\x0c\ + R\x06amount\"2\n\x15MintlayerUnmintTokens\x12\x19\n\x08token_id\x18\x01\ + \x20\x02(\tR\x07tokenId\"5\n\x18MintlayerLockTokenSupply\x12\x19\n\x08to\ + ken_id\x18\x01\x20\x02(\tR\x07tokenId\"a\n\x14MintlayerFreezeToken\x12\ + \x19\n\x08token_id\x18\x01\x20\x02(\tR\x07tokenId\x12.\n\x13is_token_unf\ + reezabe\x18\x02\x20\x02(\x08R\x11isTokenUnfreezabe\"3\n\x16MintlayerUnfr\ + eezeToken\x12\x19\n\x08token_id\x18\x01\x20\x02(\tR\x07tokenId\"\\\n\x1d\ + MintlayerChangeTokenAuhtority\x12\x19\n\x08token_id\x18\x01\x20\x02(\tR\ + \x07tokenId\x12\x20\n\x0bdestination\x18\x02\x20\x02(\tR\x0bdestination\ + \"3\n\x16MintlayerConcludeOrder\x12\x19\n\x08order_id\x18\x01\x20\x02(\t\ + R\x07orderId\"i\n\x12MintlayerFillOrder\x12\x19\n\x08order_id\x18\x01\ + \x20\x02(\tR\x07orderId\x12\x16\n\x06amount\x18\x02\x20\x02(\x0cR\x06amo\ + unt\x12\x20\n\x0bdestination\x18\x03\x20\x02(\tR\x0bdestination\"_\n\x1f\ + MintlayerChangeTokenMetadataUri\x12\x19\n\x08token_id\x18\x01\x20\x02(\t\ + R\x07tokenId\x12!\n\x0cmetadata_uri\x18\x02\x20\x02(\x0cR\x0bmetadataUri\ + \"\xbd\t\n\x11MintlayerTxOutput\x12S\n\x08transfer\x18\x01\x20\x01(\x0b2\ + 7.hw.trezor.messages.mintlayer.MintlayerTransferTxOutputR\x08transfer\ + \x12m\n\x12lock_then_transfer\x18\x02\x20\x01(\x0b2?.hw.trezor.messages.\ + mintlayer.MintlayerLockThenTransferTxOutputR\x10lockThenTransfer\x12G\n\ + \x04burn\x18\x03\x20\x01(\x0b23.hw.trezor.messages.mintlayer.MintlayerBu\ + rnTxOutputR\x04burn\x12j\n\x11create_stake_pool\x18\x04\x20\x01(\x0b2>.h\ + w.trezor.messages.mintlayer.MintlayerCreateStakePoolTxOutputR\x0fcreateS\ + takePool\x12}\n\x18produce_block_from_stake\x18\x05\x20\x01(\x0b2D.hw.tr\ + ezor.messages.mintlayer.MintlayerProduceBlockFromStakeTxOutputR\x15produ\ + ceBlockFromStake\x12s\n\x14create_delegation_id\x18\x06\x20\x01(\x0b2A.h\ + w.trezor.messages.mintlayer.MintlayerCreateDelegationIdTxOutputR\x12crea\ + teDelegationId\x12i\n\x10delegate_staking\x18\x07\x20\x01(\x0b2>.hw.trez\ + or.messages.mintlayer.MintlayerDelegateStakingTxOutputR\x0fdelegateStaki\ + ng\x12s\n\x14issue_fungible_token\x18\x08\x20\x01(\x0b2A.hw.trezor.messa\ + ges.mintlayer.MintlayerIssueFungibleTokenTxOutputR\x12issueFungibleToken\ + \x12T\n\tissue_nft\x18\t\x20\x01(\x0b27.hw.trezor.messages.mintlayer.Min\ + tlayerIssueNftTxOutputR\x08issueNft\x12]\n\x0cdata_deposit\x18\n\x20\x01\ + (\x0b2:.hw.trezor.messages.mintlayer.MintlayerDataDepositTxOutputR\x0bda\ + taDeposit\x12G\n\x04htlc\x18\x0b\x20\x01(\x0b23.hw.trezor.messages.mintl\ + ayer.MintlayerHtlcTxOutputR\x04htlc\x12]\n\x0ccreate_order\x18\x0c\x20\ + \x01(\x0b2:.hw.trezor.messages.mintlayer.MintlayerCreateOrderTxOutputR\ + \x0bcreateOrder\"\x87\x01\n\x19MintlayerTokenOutputValue\x12\x19\n\x08to\ + ken_id\x18\x01\x20\x02(\tR\x07tokenId\x12!\n\x0ctoken_ticker\x18\x02\x20\ + \x02(\x0cR\x0btokenTicker\x12,\n\x12number_of_decimals\x18\x03\x20\x02(\ + \rR\x10numberOfDecimals\"}\n\x14MintlayerOutputValue\x12\x16\n\x06amount\ + \x18\x01\x20\x02(\x0cR\x06amount\x12M\n\x05token\x18\x02\x20\x01(\x0b27.\ + hw.trezor.messages.mintlayer.MintlayerTokenOutputValueR\x05token\"\x7f\n\ + \x19MintlayerTransferTxOutput\x12\x18\n\x07address\x18\x01\x20\x02(\tR\ + \x07address\x12H\n\x05value\x18\x02\x20\x02(\x0b22.hw.trezor.messages.mi\ + ntlayer.MintlayerOutputValueR\x05value\"\xa4\x01\n\x17MintlayerOutputTim\ + eLock\x12!\n\x0cuntil_height\x18\x01\x20\x01(\x04R\x0buntilHeight\x12\ + \x1d\n\nuntil_time\x18\x02\x20\x01(\x04R\tuntilTime\x12&\n\x0ffor_block_\ + count\x18\x03\x20\x01(\x04R\rforBlockCount\x12\x1f\n\x0bfor_seconds\x18\ + \x04\x20\x01(\x04R\nforSeconds\"\xd2\x01\n!MintlayerLockThenTransferTxOu\ + tput\x12\x18\n\x07address\x18\x01\x20\x02(\tR\x07address\x12H\n\x05value\ + \x18\x02\x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOutputValu\ + eR\x05value\x12I\n\x04lock\x18\x03\x20\x02(\x0b25.hw.trezor.messages.min\ + tlayer.MintlayerOutputTimeLockR\x04lock\"a\n\x15MintlayerBurnTxOutput\ + \x12H\n\x05value\x18\x01\x20\x02(\x0b22.hw.trezor.messages.mintlayer.Min\ + tlayerOutputValueR\x05value\"\x9d\x02\n\x20MintlayerCreateStakePoolTxOut\ + put\x12\x17\n\x07pool_id\x18\x01\x20\x02(\tR\x06poolId\x12\x16\n\x06pled\ + ge\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\x0cvrfPublicK\ + ey\x12)\n\x10decommission_key\x18\x05\x20\x02(\tR\x0fdecommissionKey\x12\ + 9\n\x19margin_ratio_per_thousand\x18\x06\x20\x02(\rR\x16marginRatioPerTh\ + ousand\x12$\n\x0ecost_per_block\x18\x07\x20\x02(\x0cR\x0ccostPerBlock\"c\ + \n&MintlayerProduceBlockFromStakeTxOutput\x12\x20\n\x0bdestination\x18\ + \x01\x20\x02(\tR\x0bdestination\x12\x17\n\x07pool_id\x18\x02\x20\x02(\tR\ + \x06poolId\"`\n#MintlayerCreateDelegationIdTxOutput\x12\x20\n\x0bdestina\ + tion\x18\x01\x20\x02(\tR\x0bdestination\x12\x17\n\x07pool_id\x18\x02\x20\ + \x02(\tR\x06poolId\"_\n\x20MintlayerDelegateStakingTxOutput\x12\x16\n\ + \x06amount\x18\x01\x20\x02(\x0cR\x06amount\x12#\n\rdelegation_id\x18\x02\ + \x20\x02(\tR\x0cdelegationId\"\x8f\x01\n\x19MintlayerTokenTotalSupply\ + \x12O\n\x04type\x18\x01\x20\x02(\x0e2;.hw.trezor.messages.mintlayer.Mint\ + layerTokenTotalSupplyTypeR\x04type\x12!\n\x0cfixed_amount\x18\x02\x20\ + \x01(\x0cR\x0bfixedAmount\"\xb6\x02\n#MintlayerIssueFungibleTokenTxOutpu\ + t\x12!\n\x0ctoken_ticker\x18\x01\x20\x02(\x0cR\x0btokenTicker\x12,\n\x12\ + number_of_decimals\x18\x02\x20\x02(\rR\x10numberOfDecimals\x12!\n\x0cmet\ + adata_uri\x18\x03\x20\x02(\x0cR\x0bmetadataUri\x12Z\n\x0ctotal_supply\ + \x18\x04\x20\x02(\x0b27.hw.trezor.messages.mintlayer.MintlayerTokenTotal\ + SupplyR\x0btotalSupply\x12\x1c\n\tauthority\x18\x05\x20\x02(\tR\tauthori\ + ty\x12!\n\x0cis_freezable\x18\x06\x20\x02(\x08R\x0bisFreezable\"\xcf\x02\ + \n\x19MintlayerIssueNftTxOutput\x12\x19\n\x08token_id\x18\x01\x20\x02(\t\ + R\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\x0bdescription\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\x07iconUri\x126\n\x17additi\ + onal_metadata_uri\x18\x08\x20\x01(\x0cR\x15additionalMetadataUri\x12\x1b\ + \n\tmedia_uri\x18\t\x20\x01(\x0cR\x08mediaUri\x12\x1d\n\nmedia_hash\x18\ + \n\x20\x02(\x0cR\tmediaHash\"2\n\x1cMintlayerDataDepositTxOutput\x12\x12\ + \n\x04data\x18\x01\x20\x02(\x0cR\x04data\"\x9e\x02\n\x15MintlayerHtlcTxO\ + utput\x12H\n\x05value\x18\x01\x20\x02(\x0b22.hw.trezor.messages.mintlaye\ + r.MintlayerOutputValueR\x05value\x12\x1f\n\x0bsecret_hash\x18\x02\x20\ + \x02(\x0cR\nsecretHash\x12\x1b\n\tspend_key\x18\x03\x20\x02(\tR\x08spend\ + Key\x12^\n\x0frefund_timelock\x18\x04\x20\x02(\x0b25.hw.trezor.messages.\ + mintlayer.MintlayerOutputTimeLockR\x0erefundTimelock\x12\x1d\n\nrefund_k\ + ey\x18\x05\x20\x02(\tR\trefundKey\"\xcf\x01\n\x1cMintlayerCreateOrderTxO\ + utput\x12!\n\x0cconclude_key\x18\x01\x20\x02(\tR\x0bconcludeKey\x12D\n\ + \x03ask\x18\x02\x20\x02(\x0b22.hw.trezor.messages.mintlayer.MintlayerOut\ + putValueR\x03ask\x12F\n\x04give\x18\x03\x20\x02(\x0b22.hw.trezor.message\ + s.mintlayer.MintlayerOutputValueR\x04give\"\xdf\x01\n\x17MintlayerTxAckU\ + txoInput\x12`\n\x02tx\x18\x01\x20\x02(\x0b2P.hw.trezor.messages.mintlaye\ + r.MintlayerTxAckUtxoInput.MintlayerTxAckInputWrapperR\x02tx\x1ab\n\x1aMi\ + ntlayerTxAckInputWrapper\x12D\n\x05input\x18\x01\x20\x02(\x0b2..hw.trezo\ + r.messages.mintlayer.MintlayerTxInputR\x05input\"\xde\x01\n\x14Mintlayer\ + TxAckOutput\x12^\n\x02tx\x18\x01\x20\x02(\x0b2N.hw.trezor.messages.mintl\ + ayer.MintlayerTxAckOutput.MintlayerTxAckOutputWrapperR\x02tx\x1af\n\x1bM\ + intlayerTxAckOutputWrapper\x12G\n\x06output\x18\x01\x20\x02(\x0b2/.hw.tr\ + ezor.messages.mintlayer.MintlayerTxOutputR\x06output*/\n\x11MintlayerUtx\ + oType\x12\x0f\n\x0bTRANSACTION\x10\0\x12\t\n\x05BLOCK\x10\x01*G\n\x1dMin\ + tlayerTokenTotalSupplyType\x12\t\n\x05FIXED\x10\0\x12\x0c\n\x08LOCKABLE\ + \x10\x01\x12\r\n\tUNLIMITED\x10\x02B=\n#com.satoshilabs.trezor.lib.proto\ + bufB\x16TrezorMessageMintlayer\ "; /// `FileDescriptorProto` object which was a source for this generated file @@ -11634,7 +11045,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(48); + let mut messages = ::std::vec::Vec::with_capacity(45); messages.push(MintlayerGetAddress::generated_message_descriptor_data()); messages.push(MintlayerAddress::generated_message_descriptor_data()); messages.push(MintlayerGetPublicKey::generated_message_descriptor_data()); @@ -11672,10 +11083,7 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { messages.push(MintlayerIssueNftTxOutput::generated_message_descriptor_data()); messages.push(MintlayerDataDepositTxOutput::generated_message_descriptor_data()); messages.push(MintlayerHtlcTxOutput::generated_message_descriptor_data()); - messages.push(MintlayerAnyoneCanTakeTxOutput::generated_message_descriptor_data()); - messages.push(MintlayerPrevTx::generated_message_descriptor_data()); - messages.push(MintlayerPrevInput::generated_message_descriptor_data()); - messages.push(MintlayerPrevTransferOutput::generated_message_descriptor_data()); + messages.push(MintlayerCreateOrderTxOutput::generated_message_descriptor_data()); messages.push(MintlayerTxAckUtxoInput::generated_message_descriptor_data()); messages.push(MintlayerTxAckOutput::generated_message_descriptor_data()); messages.push(mintlayer_tx_request::MintlayerTxRequestDetailsType::generated_message_descriptor_data());