1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-05-07 17:39:03 +00:00

feat(core): add loadable solana tokens

This commit is contained in:
Eugene Rossokha 2025-01-10 15:29:00 +02:00 committed by matejcik
parent 1d444c3845
commit ffbdea202a
35 changed files with 1577 additions and 831 deletions

View File

@ -1623,7 +1623,8 @@
{ {
"name": "mint", "name": "mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "account_to_mint", "name": "account_to_mint",
@ -1676,7 +1677,8 @@
{ {
"name": "token_mint", "name": "token_mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "owner", "name": "owner",
@ -1754,7 +1756,8 @@
{ {
"name": "token_mint", "name": "token_mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "freeze_authority", "name": "freeze_authority",
@ -1791,7 +1794,8 @@
{ {
"name": "token_mint", "name": "token_mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "freeze_authority", "name": "freeze_authority",
@ -1839,7 +1843,8 @@
{ {
"name": "token_mint", "name": "token_mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "destination_account", "name": "destination_account",
@ -1900,7 +1905,8 @@
{ {
"name": "token_mint", "name": "token_mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "delegate", "name": "delegate",
@ -1956,7 +1962,8 @@
{ {
"name": "mint", "name": "mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "account_to_mint", "name": "account_to_mint",
@ -2013,7 +2020,8 @@
{ {
"name": "token_mint", "name": "token_mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "owner", "name": "owner",
@ -2430,7 +2438,8 @@
{ {
"name": "mint", "name": "mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "account_to_mint", "name": "account_to_mint",
@ -2483,7 +2492,8 @@
{ {
"name": "token_mint", "name": "token_mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "owner", "name": "owner",
@ -2561,7 +2571,8 @@
{ {
"name": "token_mint", "name": "token_mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "freeze_authority", "name": "freeze_authority",
@ -2598,7 +2609,8 @@
{ {
"name": "token_mint", "name": "token_mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "freeze_authority", "name": "freeze_authority",
@ -2646,7 +2658,8 @@
{ {
"name": "token_mint", "name": "token_mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "destination_account", "name": "destination_account",
@ -2707,7 +2720,8 @@
{ {
"name": "token_mint", "name": "token_mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "delegate", "name": "delegate",
@ -2763,7 +2777,8 @@
{ {
"name": "mint", "name": "mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "account_to_mint", "name": "account_to_mint",
@ -2820,7 +2835,8 @@
{ {
"name": "token_mint", "name": "token_mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "owner", "name": "owner",
@ -2997,7 +3013,8 @@
{ {
"name": "token_mint", "name": "token_mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "system_program", "name": "system_program",
@ -3059,7 +3076,8 @@
{ {
"name": "token_mint", "name": "token_mint",
"is_authority": false, "is_authority": false,
"optional": false "optional": false,
"is_token_mint": true
}, },
{ {
"name": "system_program", "name": "system_program",

View File

@ -1,4 +1,4 @@
check: messages.pb messages-binance.pb messages-bitcoin.pb messages-bootloader.pb messages-cardano.pb messages-common.pb messages-crypto.pb messages-debug.pb messages-ethereum.pb messages-management.pb messages-monero.pb messages-nem.pb messages-ripple.pb messages-stellar.pb messages-tezos.pb messages-eos.pb check: messages.pb messages-binance.pb messages-bitcoin.pb messages-bootloader.pb messages-cardano.pb messages-common.pb messages-crypto.pb messages-debug.pb messages-ethereum.pb messages-management.pb messages-monero.pb messages-nem.pb messages-ripple.pb messages-stellar.pb messages-tezos.pb messages-eos.pb messages-solana.pb messages-definitions.pb
%.pb: %.proto %.pb: %.proto
protoc -I/usr/include -I. $< -o $@ protoc -I/usr/include -I. $< -o $@

View File

@ -0,0 +1,61 @@
syntax = "proto2";
package hw.trezor.messages.definitions;
// Sugar for easier handling in Java
option java_package = "com.satoshilabs.trezor.lib.protobuf";
option java_outer_classname = "TrezorMessageDefinitions";
/**
* Definitions type enum.
* Used to check the encoded EthereumNetworkInfo/EthereumTokenInfo/SolanaTokenInfo message.
*/
enum DefinitionType {
ETHEREUM_NETWORK = 0;
ETHEREUM_TOKEN = 1;
SOLANA_TOKEN = 2;
}
// ****** CROSS-PARSEABILITY NOTE ******
//
// Neither definition type should be cross-parseable with any other definition type.
// That is, any parser shoud *fail to parse* a data blob of, e.g., EthereumNetworkInfo,
// as a different definition type, e.g., SolanaTokenInfo.
//
// To achieve that, we vary the wire types of the fields in order:
//
// * EthereumNetworkInfo: varint, length-delimited, ...
// * EthereumTokenInfo: length-delimited, varint, ...
// * SolanaTokenInfo: length-delimited, length-delimited, ...
/**
* Ethereum network definition.
* @embed
*/
message EthereumNetworkInfo {
required uint64 chain_id = 1;
required string symbol = 2;
required uint32 slip44 = 3;
required string name = 4;
}
/**
* Ethereum token definition.
* @embed
*/
message EthereumTokenInfo {
required bytes address = 1;
required uint64 chain_id = 2;
required string symbol = 3;
required uint32 decimals = 4;
required string name = 5;
}
/**
* Solana token definition.
* @embed
*/
message SolanaTokenInfo {
required bytes mint = 1; // token mint - unique token id
required string symbol = 2;
required string name = 3;
}

View File

@ -1,60 +0,0 @@
syntax = "proto2";
package hw.trezor.messages.ethereum_definitions;
// Sugar for easier handling in Java
option java_package = "com.satoshilabs.trezor.lib.protobuf";
option java_outer_classname = "TrezorMessageEthereumDefinitions";
/**
* Ethereum definitions type enum.
* Used to check the encoded EthereumNetworkInfo or EthereumTokenInfo message.
*/
enum EthereumDefinitionType {
NETWORK = 0;
TOKEN = 1;
}
/**
* Ethereum network definition. Used to (de)serialize the definition.
*
* Definition types should not be cross-parseable, i.e., it should not be possible to
* incorrectly parse network info as token info or vice versa.
* To achieve that, the first field is wire type varint while the second field is wire type
* length-delimited. Both are a mismatch for the token definition.
*
* @embed
*/
message EthereumNetworkInfo {
required uint64 chain_id = 1;
required string symbol = 2;
required uint32 slip44 = 3;
required string name = 4;
}
/**
* Ethereum token definition. Used to (de)serialize the definition.
*
* Definition types should not be cross-parseable, i.e., it should not be possible to
* incorrectly parse network info as token info or vice versa.
* To achieve that, the first field is wire type length-delimited while the second field
* is wire type varint. Both are a mismatch for the network definition.
*
* @embed
*/
message EthereumTokenInfo {
required bytes address = 1;
required uint64 chain_id = 2;
required string symbol = 3;
required uint32 decimals = 4;
required string name = 5;
}
/**
* Contains an encoded Ethereum network and/or token definition. See ethereum-definitions.md for details.
* @embed
*/
message EthereumDefinitions {
optional bytes encoded_network = 1; // encoded Ethereum network
optional bytes encoded_token = 2; // encoded Ethereum token
}

View File

@ -5,7 +5,7 @@ package hw.trezor.messages.ethereum_eip712;
option java_package = "com.satoshilabs.trezor.lib.protobuf"; option java_package = "com.satoshilabs.trezor.lib.protobuf";
option java_outer_classname = "TrezorMessageEthereumEIP712"; option java_outer_classname = "TrezorMessageEthereumEIP712";
import "messages-ethereum-definitions.proto"; import "messages-ethereum.proto";
// Separated from messages-ethereum.proto as it is not implemented on T1 side // Separated from messages-ethereum.proto as it is not implemented on T1 side
@ -22,10 +22,10 @@ import "messages-ethereum-definitions.proto";
* @next Failure * @next Failure
*/ */
message EthereumSignTypedData { message EthereumSignTypedData {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
required string primary_type = 2; // name of the root message struct required string primary_type = 2; // name of the root message struct
optional bool metamask_v4_compat = 3 [default=true]; // use MetaMask v4 (see https://github.com/MetaMask/eth-sig-util/issues/106) optional bool metamask_v4_compat = 3 [default=true]; // use MetaMask v4 (see https://github.com/MetaMask/eth-sig-util/issues/106)
optional ethereum_definitions.EthereumDefinitions definitions = 4; // network and/or token definitions optional ethereum.EthereumDefinitions definitions = 4; // network and/or token definitions
} }
/** /**

View File

@ -6,7 +6,6 @@ option java_package = "com.satoshilabs.trezor.lib.protobuf";
option java_outer_classname = "TrezorMessageEthereum"; option java_outer_classname = "TrezorMessageEthereum";
import "messages-common.proto"; import "messages-common.proto";
import "messages-ethereum-definitions.proto";
/** /**
* Request: Ask device for public key corresponding to address_n path * Request: Ask device for public key corresponding to address_n path
@ -60,18 +59,18 @@ message EthereumAddress {
* @next Failure * @next Failure
*/ */
message EthereumSignTx { message EthereumSignTx {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
optional bytes nonce = 2 [default='']; // <=256 bit unsigned big endian optional bytes nonce = 2 [default='']; // <=256 bit unsigned big endian
required bytes gas_price = 3; // <=256 bit unsigned big endian (in wei) required bytes gas_price = 3; // <=256 bit unsigned big endian (in wei)
required bytes gas_limit = 4; // <=256 bit unsigned big endian required bytes gas_limit = 4; // <=256 bit unsigned big endian
optional string to = 11 [default='']; // recipient address optional string to = 11 [default='']; // recipient address
optional bytes value = 6 [default='']; // <=256 bit unsigned big endian (in wei) optional bytes value = 6 [default='']; // <=256 bit unsigned big endian (in wei)
optional bytes data_initial_chunk = 7 [default='']; // The initial data chunk (<= 1024 bytes) optional bytes data_initial_chunk = 7 [default='']; // The initial data chunk (<= 1024 bytes)
optional uint32 data_length = 8 [default=0]; // Length of transaction payload optional uint32 data_length = 8 [default=0]; // Length of transaction payload
required uint64 chain_id = 9; // Chain Id for EIP 155 required uint64 chain_id = 9; // Chain Id for EIP 155
optional uint32 tx_type = 10; // Used for Wanchain optional uint32 tx_type = 10; // Used for Wanchain
optional ethereum_definitions.EthereumDefinitions definitions = 12; // network and/or token definitions for tx optional EthereumDefinitions definitions = 12; // network and/or token definitions for tx
optional bool chunkify = 13; // display the address in chunks of 4 characters optional bool chunkify = 13; // display the address in chunks of 4 characters
} }
/** /**
@ -82,19 +81,19 @@ message EthereumSignTx {
* @next Failure * @next Failure
*/ */
message EthereumSignTxEIP1559 { message EthereumSignTxEIP1559 {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
required bytes nonce = 2; // <=256 bit unsigned big endian required bytes nonce = 2; // <=256 bit unsigned big endian
required bytes max_gas_fee = 3; // <=256 bit unsigned big endian (in wei) required bytes max_gas_fee = 3; // <=256 bit unsigned big endian (in wei)
required bytes max_priority_fee = 4; // <=256 bit unsigned big endian (in wei) required bytes max_priority_fee = 4; // <=256 bit unsigned big endian (in wei)
required bytes gas_limit = 5; // <=256 bit unsigned big endian required bytes gas_limit = 5; // <=256 bit unsigned big endian
optional string to = 6 [default='']; // recipient address optional string to = 6 [default='']; // recipient address
required bytes value = 7; // <=256 bit unsigned big endian (in wei) required bytes value = 7; // <=256 bit unsigned big endian (in wei)
optional bytes data_initial_chunk = 8 [default='']; // The initial data chunk (<= 1024 bytes) optional bytes data_initial_chunk = 8 [default='']; // The initial data chunk (<= 1024 bytes)
required uint32 data_length = 9; // Length of transaction payload required uint32 data_length = 9; // Length of transaction payload
required uint64 chain_id = 10; // Chain Id for EIP 155 required uint64 chain_id = 10; // Chain Id for EIP 155
repeated EthereumAccessList access_list = 11; // Access List repeated EthereumAccessList access_list = 11; // Access List
optional ethereum_definitions.EthereumDefinitions definitions = 12; // network and/or token definitions for tx optional EthereumDefinitions definitions = 12; // network and/or token definitions for tx
optional bool chunkify = 13; // display the address in chunks of 4 characters optional bool chunkify = 13; // display the address in chunks of 4 characters
message EthereumAccessList { message EthereumAccessList {
required string address = 1; required string address = 1;
@ -180,3 +179,12 @@ message EthereumTypedDataSignature {
required bytes signature = 1; // signature of the typed data required bytes signature = 1; // signature of the typed data
required string address = 2; // address used to sign the typed data required string address = 2; // address used to sign the typed data
} }
/**
* Contains an encoded network and/or token definition. See ethereum-definitions.md for details.
* @embed
*/
message EthereumDefinitions {
optional bytes encoded_network = 1; // encoded ethereum network
optional bytes encoded_token = 2; // encoded ethereum token
}

View File

@ -55,6 +55,7 @@ message SolanaTxTokenAccountInfo {
*/ */
message SolanaTxAdditionalInfo { message SolanaTxAdditionalInfo {
repeated SolanaTxTokenAccountInfo token_accounts_infos = 1; repeated SolanaTxTokenAccountInfo token_accounts_infos = 1;
optional bytes encoded_token = 2;
} }
/** /**

View File

@ -171,7 +171,7 @@ def render_file(
result = template.render( result = template.render(
support_info=support_info, support_info=support_info,
supported_on=make_support_filter(support_info), supported_on=make_support_filter(support_info),
ethereum_defs_timestamp=int(eth_defs_date.timestamp()), defs_timestamp=int(eth_defs_date.timestamp()),
THIS_FILE=this_file, THIS_FILE=this_file,
ROOT=ROOT, ROOT=ROOT,
ALTCOIN_PREFIXES=ALTCOIN_PREFIXES, ALTCOIN_PREFIXES=ALTCOIN_PREFIXES,

View File

@ -614,13 +614,13 @@ if FROZEN:
) )
)) ))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/messages/__init__.py'))
SOURCE_PY_DEBUG_ENUMS = [SOURCE_PY_DIR + 'trezor/enums/Debug*.py'] SOURCE_PY_DEBUG_ENUMS = [SOURCE_PY_DIR + 'trezor/enums/Debug*.py']
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/*.py', SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/*.py',
exclude=[ exclude=[
SOURCE_PY_DIR + 'trezor/enums/Binance*.py', SOURCE_PY_DIR + 'trezor/enums/Binance*.py',
SOURCE_PY_DIR + 'trezor/enums/Cardano*.py', SOURCE_PY_DIR + 'trezor/enums/Cardano*.py',
SOURCE_PY_DIR + 'trezor/enums/DebugMonero*.py', SOURCE_PY_DIR + 'trezor/enums/DebugMonero*.py',
SOURCE_PY_DIR + 'trezor/enums/DefinitionType.py',
SOURCE_PY_DIR + 'trezor/enums/Eos*.py', SOURCE_PY_DIR + 'trezor/enums/Eos*.py',
SOURCE_PY_DIR + 'trezor/enums/Ethereum*.py', SOURCE_PY_DIR + 'trezor/enums/Ethereum*.py',
SOURCE_PY_DIR + 'trezor/enums/Monero*.py', SOURCE_PY_DIR + 'trezor/enums/Monero*.py',
@ -636,8 +636,11 @@ if FROZEN:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/common/*.py', SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/common/*.py',
exclude=[ exclude=[
SOURCE_PY_DIR + 'apps/common/sdcard.py', SOURCE_PY_DIR + 'apps/common/definitions.py',
] if not SDCARD else [] SOURCE_PY_DIR + 'apps/common/definitions_constants.py',
] + (
[SOURCE_PY_DIR + 'apps/common/sdcard.py'] if not SDCARD else []
)
)) ))
if PYOPT == '0': if PYOPT == '0':
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/debug/*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/debug/*.py'))
@ -669,6 +672,10 @@ if FROZEN:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/thp/*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/thp/*.py'))
if EVERYTHING: if EVERYTHING:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/common/definitions.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/common/definitions_constants.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/DefinitionType.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/binance/*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/binance/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Binance*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Binance*.py'))

View File

@ -668,13 +668,13 @@ if FROZEN:
) )
)) ))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/messages/__init__.py'))
SOURCE_PY_DEBUG_ENUMS = [SOURCE_PY_DIR + 'trezor/enums/Debug*.py'] SOURCE_PY_DEBUG_ENUMS = [SOURCE_PY_DIR + 'trezor/enums/Debug*.py']
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/*.py', SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/*.py',
exclude=[ exclude=[
SOURCE_PY_DIR + 'trezor/enums/Binance*.py', SOURCE_PY_DIR + 'trezor/enums/Binance*.py',
SOURCE_PY_DIR + 'trezor/enums/Cardano*.py', SOURCE_PY_DIR + 'trezor/enums/Cardano*.py',
SOURCE_PY_DIR + 'trezor/enums/DebugMonero*.py', SOURCE_PY_DIR + 'trezor/enums/DebugMonero*.py',
SOURCE_PY_DIR + 'trezor/enums/DefinitionType.py',
SOURCE_PY_DIR + 'trezor/enums/Eos*.py', SOURCE_PY_DIR + 'trezor/enums/Eos*.py',
SOURCE_PY_DIR + 'trezor/enums/Ethereum*.py', SOURCE_PY_DIR + 'trezor/enums/Ethereum*.py',
SOURCE_PY_DIR + 'trezor/enums/Monero*.py', SOURCE_PY_DIR + 'trezor/enums/Monero*.py',
@ -690,8 +690,11 @@ if FROZEN:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/common/*.py', SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/common/*.py',
exclude=[ exclude=[
SOURCE_PY_DIR + 'apps/common/sdcard.py', SOURCE_PY_DIR + 'apps/common/definitions.py',
] if "sd_card" not in FEATURES_AVAILABLE else [] SOURCE_PY_DIR + 'apps/common/definitions_constants.py',
] + (
[SOURCE_PY_DIR + 'apps/common/sdcard.py'] if "sd_card" not in FEATURES_AVAILABLE else []
)
)) ))
if PYOPT == '0': if PYOPT == '0':
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/debug/*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/debug/*.py'))
@ -724,6 +727,10 @@ if FROZEN:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/thp/*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/thp/*.py'))
if EVERYTHING: if EVERYTHING:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/common/definitions.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/common/definitions_constants.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/DefinitionType.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/binance/*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/binance/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Binance*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Binance*.py'))

View File

@ -0,0 +1,91 @@
from typing import TYPE_CHECKING
from trezor.messages import EthereumNetworkInfo, EthereumTokenInfo, SolanaTokenInfo
from trezor.wire import DataError
if TYPE_CHECKING:
from typing import TypeVar
# NOTE: it's important all DefType variants can't be cross-parsed
DefType = TypeVar(
"DefType", EthereumNetworkInfo, EthereumTokenInfo, SolanaTokenInfo
)
def decode_definition(definition: bytes, expected_type: type[DefType]) -> DefType:
from trezor.crypto.cosi import verify as cosi_verify
from trezor.crypto.hashlib import sha256
from trezor.enums import DefinitionType
from trezor.protobuf import decode as protobuf_decode
from trezor.utils import BufferReader
from apps.common import readers
from . import definitions_constants as consts
r = BufferReader(definition)
# determine the type number from the expected type
expected_type_number = DefinitionType.ETHEREUM_NETWORK
# TODO: can't check equality of MsgDefObjs now, so we check the name
if expected_type.MESSAGE_NAME == EthereumTokenInfo.MESSAGE_NAME:
expected_type_number = DefinitionType.ETHEREUM_TOKEN
if expected_type.MESSAGE_NAME == SolanaTokenInfo.MESSAGE_NAME:
expected_type_number = DefinitionType.SOLANA_TOKEN
try:
# first check format version
if r.read_memoryview(len(consts.FORMAT_VERSION)) != consts.FORMAT_VERSION:
raise DataError("Invalid definition")
# second check the type of the data
if r.get() != expected_type_number:
raise DataError("Definition type mismatch")
# third check data version
if readers.read_uint32_le(r) < consts.MIN_DATA_VERSION:
raise DataError("Definition is outdated")
# get payload
payload_length = readers.read_uint16_le(r)
payload = r.read_memoryview(payload_length)
# at the end compute Merkle tree root hash using
# provided leaf data (payload with prefix) and proof
hasher = sha256(b"\x00")
hasher.update(memoryview(definition)[: r.offset])
hash = hasher.digest()
proof_length = r.get()
for _ in range(proof_length):
proof_entry = r.read_memoryview(32)
hash_a = min(hash, proof_entry)
hash_b = max(hash, proof_entry)
hasher = sha256(b"\x01")
hasher.update(hash_a)
hasher.update(hash_b)
hash = hasher.digest()
sigmask = r.get()
signature = r.read_memoryview(64)
if r.remaining_count():
raise DataError("Invalid definition")
except EOFError:
raise DataError("Invalid definition")
# verify signature
result = cosi_verify(signature, hash, consts.THRESHOLD, consts.PUBLIC_KEYS, sigmask)
if __debug__:
debug_result = cosi_verify(
signature, hash, consts.THRESHOLD, consts.DEV_PUBLIC_KEYS, sigmask
)
result = result or debug_result
if not result:
raise DataError("Invalid definition signature")
# decode it if it's OK
try:
return protobuf_decode(payload, expected_type, True)
except (ValueError, EOFError):
raise DataError("Invalid definition")

View File

@ -9,7 +9,7 @@ PUBLIC_KEYS = (
b"\xb8\xd2\xb2\x1d\xe2\x71\x24\xf0\x51\x1f\x90\x3a\xe7\xe6\x0e\x07\x96\x18\x10\xa0\xb8\xf2\x8e\xa7\x55\xfa\x50\x36\x7a\x8a\x2b\x8b", b"\xb8\xd2\xb2\x1d\xe2\x71\x24\xf0\x51\x1f\x90\x3a\xe7\xe6\x0e\x07\x96\x18\x10\xa0\xb8\xf2\x8e\xa7\x55\xfa\x50\x36\x7a\x8a\x2b\x8b",
) )
MIN_DATA_VERSION = ${ethereum_defs_timestamp} MIN_DATA_VERSION = ${defs_timestamp}
FORMAT_VERSION = b"trzd1" FORMAT_VERSION = b"trzd1"
if __debug__: if __debug__:

View File

@ -4,88 +4,8 @@ from trezor.messages import EthereumNetworkInfo, EthereumTokenInfo
from trezor.wire import DataError from trezor.wire import DataError
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import TypeVar
from typing_extensions import Self from typing_extensions import Self
DefType = TypeVar("DefType", EthereumNetworkInfo, EthereumTokenInfo)
def decode_definition(definition: bytes, expected_type: type[DefType]) -> DefType:
from trezor.crypto.cosi import verify as cosi_verify
from trezor.crypto.hashlib import sha256
from trezor.enums import EthereumDefinitionType
from trezor.protobuf import decode as protobuf_decode
from trezor.utils import BufferReader
from apps.common import readers
from . import definitions_constants as consts
# check network definition
r = BufferReader(definition)
expected_type_number = EthereumDefinitionType.NETWORK
# TODO: can't check equality of MsgDefObjs now, so we check the name
if expected_type.MESSAGE_NAME == EthereumTokenInfo.MESSAGE_NAME:
expected_type_number = EthereumDefinitionType.TOKEN
try:
# first check format version
if r.read_memoryview(len(consts.FORMAT_VERSION)) != consts.FORMAT_VERSION:
raise DataError("Invalid Ethereum definition")
# second check the type of the data
if r.get() != expected_type_number:
raise DataError("Definition type mismatch")
# third check data version
if readers.read_uint32_le(r) < consts.MIN_DATA_VERSION:
raise DataError("Definition is outdated")
# get payload
payload_length = readers.read_uint16_le(r)
payload = r.read_memoryview(payload_length)
# at the end compute Merkle tree root hash using
# provided leaf data (payload with prefix) and proof
hasher = sha256(b"\x00")
hasher.update(memoryview(definition)[: r.offset])
hash = hasher.digest()
proof_length = r.get()
for _ in range(proof_length):
proof_entry = r.read_memoryview(32)
hash_a = min(hash, proof_entry)
hash_b = max(hash, proof_entry)
hasher = sha256(b"\x01")
hasher.update(hash_a)
hasher.update(hash_b)
hash = hasher.digest()
sigmask = r.get()
signature = r.read_memoryview(64)
if r.remaining_count():
raise DataError("Invalid Ethereum definition")
except EOFError:
raise DataError("Invalid Ethereum definition")
# verify signature
result = cosi_verify(signature, hash, consts.THRESHOLD, consts.PUBLIC_KEYS, sigmask)
if __debug__:
debug_result = cosi_verify(
signature, hash, consts.THRESHOLD, consts.DEV_PUBLIC_KEYS, sigmask
)
result = result or debug_result
if not result:
raise DataError("Invalid definition signature")
# decode it if it's OK
try:
return protobuf_decode(payload, expected_type, True)
except (ValueError, EOFError):
raise DataError("Invalid Ethereum definition")
class Definitions: class Definitions:
"""Class that holds Ethereum definitions - network and tokens. """Class that holds Ethereum definitions - network and tokens.
@ -106,6 +26,8 @@ class Definitions:
chain_id: int | None = None, chain_id: int | None = None,
slip44: int | None = None, slip44: int | None = None,
) -> Self: ) -> Self:
from apps.common.definitions import decode_definition
from .networks import UNKNOWN_NETWORK, by_chain_id, by_slip44 from .networks import UNKNOWN_NETWORK, by_chain_id, by_slip44
network = UNKNOWN_NETWORK network = UNKNOWN_NETWORK

View File

@ -0,0 +1,29 @@
from typing import TYPE_CHECKING
from trezor.messages import SolanaTokenInfo
if TYPE_CHECKING:
from typing_extensions import Self
class Definitions:
"""Class that holds Solana token definitions."""
def __init__(self, tokens: dict[bytes, SolanaTokenInfo] | None = None) -> None:
self._tokens = tokens or {}
@classmethod
def from_encoded(cls, encoded_token: bytes | None) -> Self:
from apps.common.definitions import decode_definition
tokens: dict[bytes, SolanaTokenInfo] = {}
# get token definition
if encoded_token is not None:
token = decode_definition(encoded_token, SolanaTokenInfo)
tokens[token.mint] = token
return cls(tokens)
def get_token(self, mint: bytes) -> SolanaTokenInfo | None:
return self._tokens.get(mint)

View File

@ -21,6 +21,7 @@ from .types import AddressType
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Sequence from typing import Sequence
from .definitions import Definitions
from .transaction import Fee from .transaction import Fee
from .transaction.instructions import Instruction, SystemProgramTransferInstruction from .transaction.instructions import Instruction, SystemProgramTransferInstruction
from .types import AddressReference from .types import AddressReference
@ -55,6 +56,7 @@ async def confirm_instruction(
instruction_index: int, instruction_index: int,
signer_path: list[int], signer_path: list[int],
signer_public_key: bytes, signer_public_key: bytes,
definitions: Definitions,
) -> None: ) -> None:
instruction_title = ( instruction_title = (
f"{instruction_index}/{instructions_count}: {instruction.ui_name}" f"{instruction_index}/{instructions_count}: {instruction.ui_name}"
@ -114,17 +116,17 @@ async def confirm_instruction(
continue continue
account_data: list[tuple[str, str]] = [] account_data: list[tuple[str, str]] = []
# account included in the transaction directly
if len(account_value) == 2: if len(account_value) == 2:
signer_suffix = "" account_description = f"{base58.encode(account_value[0])}"
if account_value[0] == signer_public_key: if account_template.is_token_mint:
signer_suffix = f" ({TR.words__signer})" token = definitions.get_token(account_value[0])
account_description = f"{token.symbol}\n{account_description}"
elif account_value[0] == signer_public_key:
account_description = f"{account_description} ({TR.words__signer})"
account_data.append( account_data.append((ui_property.display_name, account_description))
( # lookup table address reference
ui_property.display_name,
f"{base58.encode(account_value[0])}{signer_suffix}",
)
)
elif len(account_value) == 3: elif len(account_value) == 3:
account_data += _get_address_reference_props( account_data += _get_address_reference_props(
account_value, ui_property.display_name account_value, ui_property.display_name
@ -295,6 +297,7 @@ async def confirm_token_transfer(
destination_account: bytes, destination_account: bytes,
token_account: bytes, token_account: bytes,
token_mint: bytes, token_mint: bytes,
token_symbol: str,
amount: int, amount: int,
decimals: int, decimals: int,
fee: Fee, fee: Fee,
@ -327,7 +330,7 @@ async def confirm_token_transfer(
await confirm_custom_transaction( await confirm_custom_transaction(
amount, amount,
decimals, decimals,
"[TOKEN]", token_symbol,
fee, fee,
signer_path, signer_path,
blockhash, blockhash,

View File

@ -14,9 +14,8 @@ from .transaction.instructions import (
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Type from typing import Type
from trezor.messages import SolanaTxAdditionalInfo
from .transaction import Fee from .transaction import Fee
from .types import AdditionalTxInfo
TransferTokenInstruction = ( TransferTokenInstruction = (
TokenProgramTransferCheckedInstruction TokenProgramTransferCheckedInstruction
@ -122,7 +121,7 @@ async def try_confirm_token_transfer_transaction(
fee: Fee, fee: Fee,
signer_path: list[int], signer_path: list[int],
blockhash: bytes, blockhash: bytes,
additional_info: SolanaTxAdditionalInfo | None = None, additional_info: AdditionalTxInfo,
) -> bool: ) -> bool:
from .layout import confirm_token_transfer from .layout import confirm_token_transfer
from .token_account import try_get_token_account_base_address from .token_account import try_get_token_account_base_address
@ -141,15 +140,11 @@ async def try_confirm_token_transfer_transaction(
token_mint = transfer_token_instructions[0].token_mint[0] token_mint = transfer_token_instructions[0].token_mint[0]
token_account = transfer_token_instructions[0].destination_account[0] token_account = transfer_token_instructions[0].destination_account[0]
base_address = ( base_address = try_get_token_account_base_address(
try_get_token_account_base_address( token_account,
token_account, token_program,
token_program, token_mint,
token_mint, additional_info.token_accounts_infos,
additional_info.token_accounts_infos,
)
if additional_info is not None
else None
) )
total_token_amount = sum( total_token_amount = sum(
@ -159,10 +154,16 @@ async def try_confirm_token_transfer_transaction(
] ]
) )
token_symbol = "[UNKN]"
token = additional_info.definitions.get_token(token_mint)
if token is not None:
token_symbol = token.symbol
await confirm_token_transfer( await confirm_token_transfer(
token_account if base_address is None else base_address, token_account if base_address is None else base_address,
token_account, token_account,
token_mint, token_mint,
token_symbol,
total_token_amount, total_token_amount,
transfer_token_instructions[0].decimals, transfer_token_instructions[0].decimals,
fee, fee,
@ -178,7 +179,7 @@ async def try_confirm_predefined_transaction(
signer_path: list[int], signer_path: list[int],
signer_public_key: bytes, signer_public_key: bytes,
blockhash: bytes, blockhash: bytes,
additional_info: SolanaTxAdditionalInfo | None = None, additional_info: AdditionalTxInfo,
) -> bool: ) -> bool:
from .layout import confirm_system_transfer from .layout import confirm_system_transfer
from .transaction.instructions import SystemProgramTransferInstruction from .transaction.instructions import SystemProgramTransferInstruction

View File

@ -6,6 +6,7 @@ from apps.common.keychain import with_slip44_keychain
from . import CURVE, PATTERNS, SLIP44_ID from . import CURVE, PATTERNS, SLIP44_ID
from .transaction import Transaction from .transaction import Transaction
from .types import AdditionalTxInfo
if TYPE_CHECKING: if TYPE_CHECKING:
from trezor.messages import SolanaSignTx, SolanaTxSignature from trezor.messages import SolanaSignTx, SolanaTxSignature
@ -58,15 +59,21 @@ async def sign_tx(
fee = transaction.calculate_fee() fee = transaction.calculate_fee()
additional_tx_info = AdditionalTxInfo.from_solana_tx_additional_info(
msg.additional_info
)
if not await try_confirm_predefined_transaction( if not await try_confirm_predefined_transaction(
transaction, transaction,
fee, fee,
address_n, address_n,
signer_public_key, signer_public_key,
transaction.blockhash, transaction.blockhash,
msg.additional_info, additional_tx_info,
): ):
await confirm_instructions(address_n, signer_public_key, transaction) await confirm_instructions(
address_n, signer_public_key, transaction, additional_tx_info
)
await confirm_transaction( await confirm_transaction(
address_n, address_n,
transaction.blockhash, transaction.blockhash,
@ -79,9 +86,11 @@ async def sign_tx(
async def confirm_instructions( async def confirm_instructions(
signer_path: list[int], signer_public_key: bytes, transaction: Transaction signer_path: list[int],
signer_public_key: bytes,
transaction: Transaction,
additional_info: AdditionalTxInfo,
) -> None: ) -> None:
visible_instructions = transaction.get_visible_instructions() visible_instructions = transaction.get_visible_instructions()
instructions_count = len(visible_instructions) instructions_count = len(visible_instructions)
for instruction_index, instruction in enumerate(visible_instructions, 1): for instruction_index, instruction in enumerate(visible_instructions, 1):
@ -114,4 +123,5 @@ async def confirm_instructions(
instruction_index, instruction_index,
signer_path, signer_path,
signer_public_key, signer_public_key,
additional_info.definitions,
) )

File diff suppressed because it is too large Load Diff

View File

@ -181,6 +181,7 @@ def get_instruction(
"${reference["name"]}", "${reference["name"]}",
${reference["is_authority"]}, ${reference["is_authority"]},
${reference["optional"]}, ${reference["optional"]},
${reference.get("is_token_mint", False)},
), ),
% endfor % endfor
], ],

View File

@ -1,10 +1,14 @@
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from .definitions import Definitions
if TYPE_CHECKING: if TYPE_CHECKING:
from enum import IntEnum from enum import IntEnum
from typing import Any, Callable, Generic, TypeVar from typing import Any, Callable, Generic, TypeVar
from trezor.messages import SolanaTxAdditionalInfo, SolanaTxTokenAccountInfo
from trezor.utils import BufferReader from trezor.utils import BufferReader
from typing_extensions import Self
from .transaction import Instruction from .transaction import Instruction
@ -51,10 +55,13 @@ class PropertyTemplate(Generic[T]):
class AccountTemplate: class AccountTemplate:
def __init__(self, name: str, is_authority: bool, optional: bool) -> None: def __init__(
self, name: str, is_authority: bool, optional: bool, is_token_mint: bool
) -> None:
self.name = name self.name = name
self.is_authority = is_authority self.is_authority = is_authority
self.optional = optional self.optional = optional
self.is_token_mint = is_token_mint
class UIProperty: class UIProperty:
@ -71,3 +78,26 @@ class UIProperty:
self.display_name = display_name self.display_name = display_name
self.is_authority = is_authority self.is_authority = is_authority
self.default_value_to_hide = default_value_to_hide self.default_value_to_hide = default_value_to_hide
class AdditionalTxInfo:
def __init__(
self,
token_accounts_infos: list[SolanaTxTokenAccountInfo],
definitions: Definitions,
) -> None:
self.token_accounts_infos = token_accounts_infos
self.definitions = definitions
@classmethod
def from_solana_tx_additional_info(
cls,
additional_info: SolanaTxAdditionalInfo | None,
) -> Self:
if not additional_info:
return cls(token_accounts_infos=[], definitions=Definitions())
return cls(
token_accounts_infos=additional_info.token_accounts_infos,
definitions=Definitions.from_encoded(additional_info.encoded_token),
)

View File

@ -2,5 +2,6 @@
# fmt: off # fmt: off
# isort:skip_file # isort:skip_file
NETWORK = 0 ETHEREUM_NETWORK = 0
TOKEN = 1 ETHEREUM_TOKEN = 1
SOLANA_TOKEN = 2

View File

@ -285,9 +285,10 @@ if TYPE_CHECKING:
NEXT_LAYOUT = 1 NEXT_LAYOUT = 1
CURRENT_LAYOUT = 2 CURRENT_LAYOUT = 2
class EthereumDefinitionType(IntEnum): class DefinitionType(IntEnum):
NETWORK = 0 ETHEREUM_NETWORK = 0
TOKEN = 1 ETHEREUM_TOKEN = 1
SOLANA_TOKEN = 2
class EthereumDataType(IntEnum): class EthereumDataType(IntEnum):
UINT = 1 UINT = 1

View File

@ -42,9 +42,9 @@ if TYPE_CHECKING:
from trezor.enums import DebugSwipeDirection # noqa: F401 from trezor.enums import DebugSwipeDirection # noqa: F401
from trezor.enums import DebugWaitType # noqa: F401 from trezor.enums import DebugWaitType # noqa: F401
from trezor.enums import DecredStakingSpendType # noqa: F401 from trezor.enums import DecredStakingSpendType # noqa: F401
from trezor.enums import DefinitionType # noqa: F401
from trezor.enums import DisplayRotation # noqa: F401 from trezor.enums import DisplayRotation # noqa: F401
from trezor.enums import EthereumDataType # noqa: F401 from trezor.enums import EthereumDataType # noqa: F401
from trezor.enums import EthereumDefinitionType # noqa: F401
from trezor.enums import FailureType # noqa: F401 from trezor.enums import FailureType # noqa: F401
from trezor.enums import HomescreenFormat # noqa: F401 from trezor.enums import HomescreenFormat # noqa: F401
from trezor.enums import InputScriptType # noqa: F401 from trezor.enums import InputScriptType # noqa: F401
@ -3070,6 +3070,66 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: Any) -> TypeGuard["DebugLinkOptigaSetSecMax"]: def is_type_of(cls, msg: Any) -> TypeGuard["DebugLinkOptigaSetSecMax"]:
return isinstance(msg, cls) return isinstance(msg, cls)
class EthereumNetworkInfo(protobuf.MessageType):
chain_id: "int"
symbol: "str"
slip44: "int"
name: "str"
def __init__(
self,
*,
chain_id: "int",
symbol: "str",
slip44: "int",
name: "str",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumNetworkInfo"]:
return isinstance(msg, cls)
class EthereumTokenInfo(protobuf.MessageType):
address: "bytes"
chain_id: "int"
symbol: "str"
decimals: "int"
name: "str"
def __init__(
self,
*,
address: "bytes",
chain_id: "int",
symbol: "str",
decimals: "int",
name: "str",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumTokenInfo"]:
return isinstance(msg, cls)
class SolanaTokenInfo(protobuf.MessageType):
mint: "bytes"
symbol: "str"
name: "str"
def __init__(
self,
*,
mint: "bytes",
symbol: "str",
name: "str",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["SolanaTokenInfo"]:
return isinstance(msg, cls)
class EosGetPublicKey(protobuf.MessageType): class EosGetPublicKey(protobuf.MessageType):
address_n: "list[int]" address_n: "list[int]"
show_display: "bool | None" show_display: "bool | None"
@ -3598,176 +3658,6 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: Any) -> TypeGuard["EosActionUnknown"]: def is_type_of(cls, msg: Any) -> TypeGuard["EosActionUnknown"]:
return isinstance(msg, cls) return isinstance(msg, cls)
class EthereumNetworkInfo(protobuf.MessageType):
chain_id: "int"
symbol: "str"
slip44: "int"
name: "str"
def __init__(
self,
*,
chain_id: "int",
symbol: "str",
slip44: "int",
name: "str",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumNetworkInfo"]:
return isinstance(msg, cls)
class EthereumTokenInfo(protobuf.MessageType):
address: "bytes"
chain_id: "int"
symbol: "str"
decimals: "int"
name: "str"
def __init__(
self,
*,
address: "bytes",
chain_id: "int",
symbol: "str",
decimals: "int",
name: "str",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumTokenInfo"]:
return isinstance(msg, cls)
class EthereumDefinitions(protobuf.MessageType):
encoded_network: "bytes | None"
encoded_token: "bytes | None"
def __init__(
self,
*,
encoded_network: "bytes | None" = None,
encoded_token: "bytes | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumDefinitions"]:
return isinstance(msg, cls)
class EthereumSignTypedData(protobuf.MessageType):
address_n: "list[int]"
primary_type: "str"
metamask_v4_compat: "bool"
definitions: "EthereumDefinitions | None"
def __init__(
self,
*,
primary_type: "str",
address_n: "list[int] | None" = None,
metamask_v4_compat: "bool | None" = None,
definitions: "EthereumDefinitions | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumSignTypedData"]:
return isinstance(msg, cls)
class EthereumTypedDataStructRequest(protobuf.MessageType):
name: "str"
def __init__(
self,
*,
name: "str",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumTypedDataStructRequest"]:
return isinstance(msg, cls)
class EthereumTypedDataStructAck(protobuf.MessageType):
members: "list[EthereumStructMember]"
def __init__(
self,
*,
members: "list[EthereumStructMember] | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumTypedDataStructAck"]:
return isinstance(msg, cls)
class EthereumTypedDataValueRequest(protobuf.MessageType):
member_path: "list[int]"
def __init__(
self,
*,
member_path: "list[int] | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumTypedDataValueRequest"]:
return isinstance(msg, cls)
class EthereumTypedDataValueAck(protobuf.MessageType):
value: "bytes"
def __init__(
self,
*,
value: "bytes",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumTypedDataValueAck"]:
return isinstance(msg, cls)
class EthereumStructMember(protobuf.MessageType):
type: "EthereumFieldType"
name: "str"
def __init__(
self,
*,
type: "EthereumFieldType",
name: "str",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumStructMember"]:
return isinstance(msg, cls)
class EthereumFieldType(protobuf.MessageType):
data_type: "EthereumDataType"
size: "int | None"
entry_type: "EthereumFieldType | None"
struct_name: "str | None"
def __init__(
self,
*,
data_type: "EthereumDataType",
size: "int | None" = None,
entry_type: "EthereumFieldType | None" = None,
struct_name: "str | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumFieldType"]:
return isinstance(msg, cls)
class EthereumGetPublicKey(protobuf.MessageType): class EthereumGetPublicKey(protobuf.MessageType):
address_n: "list[int]" address_n: "list[int]"
show_display: "bool | None" show_display: "bool | None"
@ -4034,6 +3924,22 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumTypedDataSignature"]: def is_type_of(cls, msg: Any) -> TypeGuard["EthereumTypedDataSignature"]:
return isinstance(msg, cls) return isinstance(msg, cls)
class EthereumDefinitions(protobuf.MessageType):
encoded_network: "bytes | None"
encoded_token: "bytes | None"
def __init__(
self,
*,
encoded_network: "bytes | None" = None,
encoded_token: "bytes | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumDefinitions"]:
return isinstance(msg, cls)
class EthereumAccessList(protobuf.MessageType): class EthereumAccessList(protobuf.MessageType):
address: "str" address: "str"
storage_keys: "list[bytes]" storage_keys: "list[bytes]"
@ -4050,6 +3956,118 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumAccessList"]: def is_type_of(cls, msg: Any) -> TypeGuard["EthereumAccessList"]:
return isinstance(msg, cls) return isinstance(msg, cls)
class EthereumSignTypedData(protobuf.MessageType):
address_n: "list[int]"
primary_type: "str"
metamask_v4_compat: "bool"
definitions: "EthereumDefinitions | None"
def __init__(
self,
*,
primary_type: "str",
address_n: "list[int] | None" = None,
metamask_v4_compat: "bool | None" = None,
definitions: "EthereumDefinitions | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumSignTypedData"]:
return isinstance(msg, cls)
class EthereumTypedDataStructRequest(protobuf.MessageType):
name: "str"
def __init__(
self,
*,
name: "str",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumTypedDataStructRequest"]:
return isinstance(msg, cls)
class EthereumTypedDataStructAck(protobuf.MessageType):
members: "list[EthereumStructMember]"
def __init__(
self,
*,
members: "list[EthereumStructMember] | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumTypedDataStructAck"]:
return isinstance(msg, cls)
class EthereumTypedDataValueRequest(protobuf.MessageType):
member_path: "list[int]"
def __init__(
self,
*,
member_path: "list[int] | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumTypedDataValueRequest"]:
return isinstance(msg, cls)
class EthereumTypedDataValueAck(protobuf.MessageType):
value: "bytes"
def __init__(
self,
*,
value: "bytes",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumTypedDataValueAck"]:
return isinstance(msg, cls)
class EthereumStructMember(protobuf.MessageType):
type: "EthereumFieldType"
name: "str"
def __init__(
self,
*,
type: "EthereumFieldType",
name: "str",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumStructMember"]:
return isinstance(msg, cls)
class EthereumFieldType(protobuf.MessageType):
data_type: "EthereumDataType"
size: "int | None"
entry_type: "EthereumFieldType | None"
struct_name: "str | None"
def __init__(
self,
*,
data_type: "EthereumDataType",
size: "int | None" = None,
entry_type: "EthereumFieldType | None" = None,
struct_name: "str | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumFieldType"]:
return isinstance(msg, cls)
class MoneroTransactionSourceEntry(protobuf.MessageType): class MoneroTransactionSourceEntry(protobuf.MessageType):
outputs: "list[MoneroOutputEntry]" outputs: "list[MoneroOutputEntry]"
real_output: "int | None" real_output: "int | None"
@ -5492,11 +5510,13 @@ if TYPE_CHECKING:
class SolanaTxAdditionalInfo(protobuf.MessageType): class SolanaTxAdditionalInfo(protobuf.MessageType):
token_accounts_infos: "list[SolanaTxTokenAccountInfo]" token_accounts_infos: "list[SolanaTxTokenAccountInfo]"
encoded_token: "bytes | None"
def __init__( def __init__(
self, self,
*, *,
token_accounts_infos: "list[SolanaTxTokenAccountInfo] | None" = None, token_accounts_infos: "list[SolanaTxTokenAccountInfo] | None" = None,
encoded_token: "bytes | None" = None,
) -> None: ) -> None:
pass pass

View File

@ -4,7 +4,7 @@ from trezor import messages, protobuf
from trezor.crypto import cosi from trezor.crypto import cosi
from trezor.crypto.curve import ed25519 from trezor.crypto.curve import ed25519
from trezor.crypto.hashlib import sha256 from trezor.crypto.hashlib import sha256
from trezor.enums import EthereumDefinitionType from trezor.enums import DefinitionType
PRIVATE_KEYS_DEV = [byte * 32 for byte in (b"\xdd", b"\xde", b"\xdf")] PRIVATE_KEYS_DEV = [byte * 32 for byte in (b"\xdd", b"\xde", b"\xdf")]
@ -41,7 +41,7 @@ def make_token(
def make_payload( def make_payload(
prefix: bytes = b"trzd1", prefix: bytes = b"trzd1",
data_type: EthereumDefinitionType = EthereumDefinitionType.NETWORK, data_type: DefinitionType = DefinitionType.ETHEREUM_NETWORK,
timestamp: int = 0xFFFF_FFFF, timestamp: int = 0xFFFF_FFFF,
message: ( message: (
messages.EthereumNetworkInfo | messages.EthereumTokenInfo | bytes messages.EthereumNetworkInfo | messages.EthereumTokenInfo | bytes
@ -106,7 +106,7 @@ def encode_network(
) -> bytes: ) -> bytes:
if network is None: if network is None:
network = make_network(chain_id, slip44, symbol, name) network = make_network(chain_id, slip44, symbol, name)
payload = make_payload(data_type=EthereumDefinitionType.NETWORK, message=network) payload = make_payload(data_type=DefinitionType.ETHEREUM_NETWORK, message=network)
proof, signature = sign_payload(payload, []) proof, signature = sign_payload(payload, [])
return payload + proof + signature return payload + proof + signature
@ -121,6 +121,6 @@ def encode_token(
) -> bytes: ) -> bytes:
if token is None: if token is None:
token = make_token(symbol, decimals, address, chain_id, name) token = make_token(symbol, decimals, address, chain_id, name)
payload = make_payload(data_type=EthereumDefinitionType.TOKEN, message=token) payload = make_payload(data_type=DefinitionType.ETHEREUM_TOKEN, message=token)
proof, signature = sign_payload(payload, []) proof, signature = sign_payload(payload, [])
return payload + proof + signature return payload + proof + signature

View File

@ -9,11 +9,12 @@ from trezor import utils, wire
if not utils.BITCOIN_ONLY: if not utils.BITCOIN_ONLY:
from ethereum_common import * from ethereum_common import *
from trezor.enums import EthereumDefinitionType from trezor.enums import DefinitionType
from trezor.messages import EthereumNetworkInfo, EthereumTokenInfo from trezor.messages import EthereumNetworkInfo, EthereumTokenInfo
from apps.common.definitions import decode_definition
from apps.ethereum import networks, tokens from apps.ethereum import networks, tokens
from apps.ethereum.definitions import Definitions, decode_definition from apps.ethereum.definitions import Definitions
TETHER_ADDRESS = b"\xda\xc1\x7f\x95\x8d\x2e\xe5\x23\xa2\x20\x62\x06\x99\x45\x97\xc1\x3d\x83\x1e\xc7" TETHER_ADDRESS = b"\xda\xc1\x7f\x95\x8d\x2e\xe5\x23\xa2\x20\x62\x06\x99\x45\x97\xc1\x3d\x83\x1e\xc7"
@ -92,7 +93,7 @@ class TestDecodeDefinition(unittest.TestCase):
def test_bad_type(self): def test_bad_type(self):
payload = make_payload( payload = make_payload(
data_type=EthereumDefinitionType.TOKEN, message=make_token() data_type=DefinitionType.ETHEREUM_TOKEN, message=make_token()
) )
proof, signature = sign_payload(payload, []) proof, signature = sign_payload(payload, [])
self.assertFailed(payload + proof + signature) self.assertFailed(payload + proof + signature)
@ -109,13 +110,13 @@ class TestDecodeDefinition(unittest.TestCase):
def test_protobuf_mismatch(self): def test_protobuf_mismatch(self):
payload = make_payload( payload = make_payload(
data_type=EthereumDefinitionType.NETWORK, message=make_token() data_type=DefinitionType.ETHEREUM_NETWORK, message=make_token()
) )
proof, signature = sign_payload(payload, []) proof, signature = sign_payload(payload, [])
self.assertFailed(payload + proof + signature) self.assertFailed(payload + proof + signature)
payload = make_payload( payload = make_payload(
data_type=EthereumDefinitionType.TOKEN, message=make_network() data_type=DefinitionType.ETHEREUM_TOKEN, message=make_network()
) )
proof, signature = sign_payload(payload, []) proof, signature = sign_payload(payload, [])
self.assertFailed(payload + proof + signature) self.assertFailed(payload + proof + signature)

View File

@ -89,7 +89,7 @@ Each definition is encoded as a protobuf message `EthereumNetworkInfo` or
All numbers are unsigned little endian. All numbers are unsigned little endian.
1. magic string `trzd1` (5 bytes) 1. magic string `trzd1` (5 bytes)
2. definition type according to `EthereumDefinitionType` enum (1 byte) 2. definition type according to `DefinitionType` enum (1 byte)
3. data version of the definition (4 bytes) 3. data version of the definition (4 bytes)
4. protobuf payload length (2 bytes) 4. protobuf payload length (2 bytes)
5. protobuf payload (N bytes) 5. protobuf payload (N bytes)

View File

@ -0,0 +1,22 @@
# Solana definitions
To allow nicer token presentation on the device, Trezor allows passing Definitions as additional info. Currently only
one token can be included in the definitions. Solana tokens are uniquely identified by their program id and mint
account, Trezor additionally expects a name and a ticker symbol.
In the future we might also include definitions for instructions.
## Retrieving the definitions
A full list of Solana definitions is compiled from multiple sources and is available [in a separate repository](TODO).
From this list, a collection of binary blobs is generated, signed, and made available online.
A given Trezor firmware will only accept signed definitions newer than a certain date, typically one month before
firmware release. This means that a client application should either always fetch fresh definitions from the official
URLs, or refresh its local copy frequently.
The base URL for the definitions is `https://data.trezor.io/firmware/solana-definitions/`.
## Definition format
Look at [`ethereum-definitions.md`'s](ethereum_definitions.md) `Definition Format` section.

View File

@ -8,7 +8,7 @@ import requests
from construct_classes import Struct, subcon from construct_classes import Struct, subcon
from . import cosi, merkle_tree from . import cosi, merkle_tree
from .messages import EthereumDefinitionType from .messages import DefinitionType
from .tools import EnumAdapter from .tools import EnumAdapter
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -38,13 +38,13 @@ ProofFormat = c.PrefixedArray(c.Int8ul, c.Bytes(32))
class DefinitionPayload(Struct): class DefinitionPayload(Struct):
magic: bytes magic: bytes
data_type: EthereumDefinitionType data_type: DefinitionType
timestamp: int timestamp: int
data: bytes data: bytes
SUBCON = c.Struct( SUBCON = c.Struct(
"magic" / c.Const(FORMAT_MAGIC), "magic" / c.Const(FORMAT_MAGIC),
"data_type" / EnumAdapter(c.Int8ul, EthereumDefinitionType), "data_type" / EnumAdapter(c.Int8ul, DefinitionType),
"timestamp" / c.Int32ul, "timestamp" / c.Int32ul,
"data" / c.Prefixed(c.Int16ul, c.GreedyBytes), "data" / c.Prefixed(c.Int16ul, c.GreedyBytes),
) )

View File

@ -326,9 +326,10 @@ class DebugWaitType(IntEnum):
CURRENT_LAYOUT = 2 CURRENT_LAYOUT = 2
class EthereumDefinitionType(IntEnum): class DefinitionType(IntEnum):
NETWORK = 0 ETHEREUM_NETWORK = 0
TOKEN = 1 ETHEREUM_TOKEN = 1
SOLANA_TOKEN = 2
class EthereumDataType(IntEnum): class EthereumDataType(IntEnum):
@ -4347,6 +4348,75 @@ class DebugLinkOptigaSetSecMax(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 9008 MESSAGE_WIRE_TYPE = 9008
class EthereumNetworkInfo(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("chain_id", "uint64", repeated=False, required=True),
2: protobuf.Field("symbol", "string", repeated=False, required=True),
3: protobuf.Field("slip44", "uint32", repeated=False, required=True),
4: protobuf.Field("name", "string", repeated=False, required=True),
}
def __init__(
self,
*,
chain_id: "int",
symbol: "str",
slip44: "int",
name: "str",
) -> None:
self.chain_id = chain_id
self.symbol = symbol
self.slip44 = slip44
self.name = name
class EthereumTokenInfo(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("address", "bytes", repeated=False, required=True),
2: protobuf.Field("chain_id", "uint64", repeated=False, required=True),
3: protobuf.Field("symbol", "string", repeated=False, required=True),
4: protobuf.Field("decimals", "uint32", repeated=False, required=True),
5: protobuf.Field("name", "string", repeated=False, required=True),
}
def __init__(
self,
*,
address: "bytes",
chain_id: "int",
symbol: "str",
decimals: "int",
name: "str",
) -> None:
self.address = address
self.chain_id = chain_id
self.symbol = symbol
self.decimals = decimals
self.name = name
class SolanaTokenInfo(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("mint", "bytes", repeated=False, required=True),
2: protobuf.Field("symbol", "string", repeated=False, required=True),
3: protobuf.Field("name", "string", repeated=False, required=True),
}
def __init__(
self,
*,
mint: "bytes",
symbol: "str",
name: "str",
) -> None:
self.mint = mint
self.symbol = symbol
self.name = name
class EosGetPublicKey(protobuf.MessageType): class EosGetPublicKey(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 600 MESSAGE_WIRE_TYPE = 600
FIELDS = { FIELDS = {
@ -4943,191 +5013,6 @@ class EosActionUnknown(protobuf.MessageType):
self.data_chunk = data_chunk self.data_chunk = data_chunk
class EthereumNetworkInfo(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("chain_id", "uint64", repeated=False, required=True),
2: protobuf.Field("symbol", "string", repeated=False, required=True),
3: protobuf.Field("slip44", "uint32", repeated=False, required=True),
4: protobuf.Field("name", "string", repeated=False, required=True),
}
def __init__(
self,
*,
chain_id: "int",
symbol: "str",
slip44: "int",
name: "str",
) -> None:
self.chain_id = chain_id
self.symbol = symbol
self.slip44 = slip44
self.name = name
class EthereumTokenInfo(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("address", "bytes", repeated=False, required=True),
2: protobuf.Field("chain_id", "uint64", repeated=False, required=True),
3: protobuf.Field("symbol", "string", repeated=False, required=True),
4: protobuf.Field("decimals", "uint32", repeated=False, required=True),
5: protobuf.Field("name", "string", repeated=False, required=True),
}
def __init__(
self,
*,
address: "bytes",
chain_id: "int",
symbol: "str",
decimals: "int",
name: "str",
) -> None:
self.address = address
self.chain_id = chain_id
self.symbol = symbol
self.decimals = decimals
self.name = name
class EthereumDefinitions(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("encoded_network", "bytes", repeated=False, required=False, default=None),
2: protobuf.Field("encoded_token", "bytes", repeated=False, required=False, default=None),
}
def __init__(
self,
*,
encoded_network: Optional["bytes"] = None,
encoded_token: Optional["bytes"] = None,
) -> None:
self.encoded_network = encoded_network
self.encoded_token = encoded_token
class EthereumSignTypedData(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 464
FIELDS = {
1: protobuf.Field("address_n", "uint32", repeated=True, required=False, default=None),
2: protobuf.Field("primary_type", "string", repeated=False, required=True),
3: protobuf.Field("metamask_v4_compat", "bool", repeated=False, required=False, default=True),
4: protobuf.Field("definitions", "EthereumDefinitions", repeated=False, required=False, default=None),
}
def __init__(
self,
*,
primary_type: "str",
address_n: Optional[Sequence["int"]] = None,
metamask_v4_compat: Optional["bool"] = True,
definitions: Optional["EthereumDefinitions"] = None,
) -> None:
self.address_n: Sequence["int"] = address_n if address_n is not None else []
self.primary_type = primary_type
self.metamask_v4_compat = metamask_v4_compat
self.definitions = definitions
class EthereumTypedDataStructRequest(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 465
FIELDS = {
1: protobuf.Field("name", "string", repeated=False, required=True),
}
def __init__(
self,
*,
name: "str",
) -> None:
self.name = name
class EthereumTypedDataStructAck(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 466
FIELDS = {
1: protobuf.Field("members", "EthereumStructMember", repeated=True, required=False, default=None),
}
def __init__(
self,
*,
members: Optional[Sequence["EthereumStructMember"]] = None,
) -> None:
self.members: Sequence["EthereumStructMember"] = members if members is not None else []
class EthereumTypedDataValueRequest(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 467
FIELDS = {
1: protobuf.Field("member_path", "uint32", repeated=True, required=False, default=None),
}
def __init__(
self,
*,
member_path: Optional[Sequence["int"]] = None,
) -> None:
self.member_path: Sequence["int"] = member_path if member_path is not None else []
class EthereumTypedDataValueAck(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 468
FIELDS = {
1: protobuf.Field("value", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
value: "bytes",
) -> None:
self.value = value
class EthereumStructMember(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("type", "EthereumFieldType", repeated=False, required=True),
2: protobuf.Field("name", "string", repeated=False, required=True),
}
def __init__(
self,
*,
type: "EthereumFieldType",
name: "str",
) -> None:
self.type = type
self.name = name
class EthereumFieldType(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("data_type", "EthereumDataType", repeated=False, required=True),
2: protobuf.Field("size", "uint32", repeated=False, required=False, default=None),
3: protobuf.Field("entry_type", "EthereumFieldType", repeated=False, required=False, default=None),
4: protobuf.Field("struct_name", "string", repeated=False, required=False, default=None),
}
def __init__(
self,
*,
data_type: "EthereumDataType",
size: Optional["int"] = None,
entry_type: Optional["EthereumFieldType"] = None,
struct_name: Optional["str"] = None,
) -> None:
self.data_type = data_type
self.size = size
self.entry_type = entry_type
self.struct_name = struct_name
class EthereumGetPublicKey(protobuf.MessageType): class EthereumGetPublicKey(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 450 MESSAGE_WIRE_TYPE = 450
FIELDS = { FIELDS = {
@ -5439,6 +5324,23 @@ class EthereumTypedDataSignature(protobuf.MessageType):
self.address = address self.address = address
class EthereumDefinitions(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("encoded_network", "bytes", repeated=False, required=False, default=None),
2: protobuf.Field("encoded_token", "bytes", repeated=False, required=False, default=None),
}
def __init__(
self,
*,
encoded_network: Optional["bytes"] = None,
encoded_token: Optional["bytes"] = None,
) -> None:
self.encoded_network = encoded_network
self.encoded_token = encoded_token
class EthereumAccessList(protobuf.MessageType): class EthereumAccessList(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
@ -5456,6 +5358,125 @@ class EthereumAccessList(protobuf.MessageType):
self.address = address self.address = address
class EthereumSignTypedData(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 464
FIELDS = {
1: protobuf.Field("address_n", "uint32", repeated=True, required=False, default=None),
2: protobuf.Field("primary_type", "string", repeated=False, required=True),
3: protobuf.Field("metamask_v4_compat", "bool", repeated=False, required=False, default=True),
4: protobuf.Field("definitions", "EthereumDefinitions", repeated=False, required=False, default=None),
}
def __init__(
self,
*,
primary_type: "str",
address_n: Optional[Sequence["int"]] = None,
metamask_v4_compat: Optional["bool"] = True,
definitions: Optional["EthereumDefinitions"] = None,
) -> None:
self.address_n: Sequence["int"] = address_n if address_n is not None else []
self.primary_type = primary_type
self.metamask_v4_compat = metamask_v4_compat
self.definitions = definitions
class EthereumTypedDataStructRequest(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 465
FIELDS = {
1: protobuf.Field("name", "string", repeated=False, required=True),
}
def __init__(
self,
*,
name: "str",
) -> None:
self.name = name
class EthereumTypedDataStructAck(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 466
FIELDS = {
1: protobuf.Field("members", "EthereumStructMember", repeated=True, required=False, default=None),
}
def __init__(
self,
*,
members: Optional[Sequence["EthereumStructMember"]] = None,
) -> None:
self.members: Sequence["EthereumStructMember"] = members if members is not None else []
class EthereumTypedDataValueRequest(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 467
FIELDS = {
1: protobuf.Field("member_path", "uint32", repeated=True, required=False, default=None),
}
def __init__(
self,
*,
member_path: Optional[Sequence["int"]] = None,
) -> None:
self.member_path: Sequence["int"] = member_path if member_path is not None else []
class EthereumTypedDataValueAck(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 468
FIELDS = {
1: protobuf.Field("value", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
value: "bytes",
) -> None:
self.value = value
class EthereumStructMember(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("type", "EthereumFieldType", repeated=False, required=True),
2: protobuf.Field("name", "string", repeated=False, required=True),
}
def __init__(
self,
*,
type: "EthereumFieldType",
name: "str",
) -> None:
self.type = type
self.name = name
class EthereumFieldType(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("data_type", "EthereumDataType", repeated=False, required=True),
2: protobuf.Field("size", "uint32", repeated=False, required=False, default=None),
3: protobuf.Field("entry_type", "EthereumFieldType", repeated=False, required=False, default=None),
4: protobuf.Field("struct_name", "string", repeated=False, required=False, default=None),
}
def __init__(
self,
*,
data_type: "EthereumDataType",
size: Optional["int"] = None,
entry_type: Optional["EthereumFieldType"] = None,
struct_name: Optional["str"] = None,
) -> None:
self.data_type = data_type
self.size = size
self.entry_type = entry_type
self.struct_name = struct_name
class MoneroTransactionSourceEntry(protobuf.MessageType): class MoneroTransactionSourceEntry(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
@ -7083,14 +7104,17 @@ class SolanaTxAdditionalInfo(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("token_accounts_infos", "SolanaTxTokenAccountInfo", repeated=True, required=False, default=None), 1: protobuf.Field("token_accounts_infos", "SolanaTxTokenAccountInfo", repeated=True, required=False, default=None),
2: protobuf.Field("encoded_token", "bytes", repeated=False, required=False, default=None),
} }
def __init__( def __init__(
self, self,
*, *,
token_accounts_infos: Optional[Sequence["SolanaTxTokenAccountInfo"]] = None, token_accounts_infos: Optional[Sequence["SolanaTxTokenAccountInfo"]] = None,
encoded_token: Optional["bytes"] = None,
) -> None: ) -> None:
self.token_accounts_infos: Sequence["SolanaTxTokenAccountInfo"] = token_accounts_infos if token_accounts_infos is not None else [] self.token_accounts_infos: Sequence["SolanaTxTokenAccountInfo"] = token_accounts_infos if token_accounts_infos is not None else []
self.encoded_token = encoded_token
class SolanaSignTx(protobuf.MessageType): class SolanaSignTx(protobuf.MessageType):

View File

@ -19,26 +19,26 @@
#![allow(unused_results)] #![allow(unused_results)]
#![allow(unused_mut)] #![allow(unused_mut)]
//! Generated file from `messages-ethereum-definitions.proto` //! Generated file from `messages-definitions.proto`
/// Generated files are compatible only with the same version /// Generated files are compatible only with the same version
/// of protobuf runtime. /// of protobuf runtime.
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0;
// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo) // @@protoc_insertion_point(message:hw.trezor.messages.definitions.EthereumNetworkInfo)
#[derive(PartialEq,Clone,Default,Debug)] #[derive(PartialEq,Clone,Default,Debug)]
pub struct EthereumNetworkInfo { pub struct EthereumNetworkInfo {
// message fields // message fields
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.chain_id) // @@protoc_insertion_point(field:hw.trezor.messages.definitions.EthereumNetworkInfo.chain_id)
pub chain_id: ::std::option::Option<u64>, pub chain_id: ::std::option::Option<u64>,
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.symbol) // @@protoc_insertion_point(field:hw.trezor.messages.definitions.EthereumNetworkInfo.symbol)
pub symbol: ::std::option::Option<::std::string::String>, pub symbol: ::std::option::Option<::std::string::String>,
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.slip44) // @@protoc_insertion_point(field:hw.trezor.messages.definitions.EthereumNetworkInfo.slip44)
pub slip44: ::std::option::Option<u32>, pub slip44: ::std::option::Option<u32>,
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.name) // @@protoc_insertion_point(field:hw.trezor.messages.definitions.EthereumNetworkInfo.name)
pub name: ::std::option::Option<::std::string::String>, pub name: ::std::option::Option<::std::string::String>,
// special fields // special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_definitions.EthereumNetworkInfo.special_fields) // @@protoc_insertion_point(special_field:hw.trezor.messages.definitions.EthereumNetworkInfo.special_fields)
pub special_fields: ::protobuf::SpecialFields, pub special_fields: ::protobuf::SpecialFields,
} }
@ -323,22 +323,22 @@ impl ::protobuf::reflect::ProtobufValue for EthereumNetworkInfo {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
} }
// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo) // @@protoc_insertion_point(message:hw.trezor.messages.definitions.EthereumTokenInfo)
#[derive(PartialEq,Clone,Default,Debug)] #[derive(PartialEq,Clone,Default,Debug)]
pub struct EthereumTokenInfo { pub struct EthereumTokenInfo {
// message fields // message fields
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.address) // @@protoc_insertion_point(field:hw.trezor.messages.definitions.EthereumTokenInfo.address)
pub address: ::std::option::Option<::std::vec::Vec<u8>>, pub address: ::std::option::Option<::std::vec::Vec<u8>>,
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.chain_id) // @@protoc_insertion_point(field:hw.trezor.messages.definitions.EthereumTokenInfo.chain_id)
pub chain_id: ::std::option::Option<u64>, pub chain_id: ::std::option::Option<u64>,
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.symbol) // @@protoc_insertion_point(field:hw.trezor.messages.definitions.EthereumTokenInfo.symbol)
pub symbol: ::std::option::Option<::std::string::String>, pub symbol: ::std::option::Option<::std::string::String>,
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.decimals) // @@protoc_insertion_point(field:hw.trezor.messages.definitions.EthereumTokenInfo.decimals)
pub decimals: ::std::option::Option<u32>, pub decimals: ::std::option::Option<u32>,
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.name) // @@protoc_insertion_point(field:hw.trezor.messages.definitions.EthereumTokenInfo.name)
pub name: ::std::option::Option<::std::string::String>, pub name: ::std::option::Option<::std::string::String>,
// special fields // special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_definitions.EthereumTokenInfo.special_fields) // @@protoc_insertion_point(special_field:hw.trezor.messages.definitions.EthereumTokenInfo.special_fields)
pub special_fields: ::protobuf::SpecialFields, pub special_fields: ::protobuf::SpecialFields,
} }
@ -678,127 +678,179 @@ impl ::protobuf::reflect::ProtobufValue for EthereumTokenInfo {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
} }
// @@protoc_insertion_point(message:hw.trezor.messages.ethereum_definitions.EthereumDefinitions) // @@protoc_insertion_point(message:hw.trezor.messages.definitions.SolanaTokenInfo)
#[derive(PartialEq,Clone,Default,Debug)] #[derive(PartialEq,Clone,Default,Debug)]
pub struct EthereumDefinitions { pub struct SolanaTokenInfo {
// message fields // message fields
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumDefinitions.encoded_network) // @@protoc_insertion_point(field:hw.trezor.messages.definitions.SolanaTokenInfo.mint)
pub encoded_network: ::std::option::Option<::std::vec::Vec<u8>>, pub mint: ::std::option::Option<::std::vec::Vec<u8>>,
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumDefinitions.encoded_token) // @@protoc_insertion_point(field:hw.trezor.messages.definitions.SolanaTokenInfo.symbol)
pub encoded_token: ::std::option::Option<::std::vec::Vec<u8>>, pub symbol: ::std::option::Option<::std::string::String>,
// @@protoc_insertion_point(field:hw.trezor.messages.definitions.SolanaTokenInfo.name)
pub name: ::std::option::Option<::std::string::String>,
// special fields // special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_definitions.EthereumDefinitions.special_fields) // @@protoc_insertion_point(special_field:hw.trezor.messages.definitions.SolanaTokenInfo.special_fields)
pub special_fields: ::protobuf::SpecialFields, pub special_fields: ::protobuf::SpecialFields,
} }
impl<'a> ::std::default::Default for &'a EthereumDefinitions { impl<'a> ::std::default::Default for &'a SolanaTokenInfo {
fn default() -> &'a EthereumDefinitions { fn default() -> &'a SolanaTokenInfo {
<EthereumDefinitions as ::protobuf::Message>::default_instance() <SolanaTokenInfo as ::protobuf::Message>::default_instance()
} }
} }
impl EthereumDefinitions { impl SolanaTokenInfo {
pub fn new() -> EthereumDefinitions { pub fn new() -> SolanaTokenInfo {
::std::default::Default::default() ::std::default::Default::default()
} }
// optional bytes encoded_network = 1; // required bytes mint = 1;
pub fn encoded_network(&self) -> &[u8] { pub fn mint(&self) -> &[u8] {
match self.encoded_network.as_ref() { match self.mint.as_ref() {
Some(v) => v, Some(v) => v,
None => &[], None => &[],
} }
} }
pub fn clear_encoded_network(&mut self) { pub fn clear_mint(&mut self) {
self.encoded_network = ::std::option::Option::None; self.mint = ::std::option::Option::None;
} }
pub fn has_encoded_network(&self) -> bool { pub fn has_mint(&self) -> bool {
self.encoded_network.is_some() self.mint.is_some()
} }
// Param is passed by value, moved // Param is passed by value, moved
pub fn set_encoded_network(&mut self, v: ::std::vec::Vec<u8>) { pub fn set_mint(&mut self, v: ::std::vec::Vec<u8>) {
self.encoded_network = ::std::option::Option::Some(v); self.mint = ::std::option::Option::Some(v);
} }
// Mutable pointer to the field. // Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first. // If field is not initialized, it is initialized with default value first.
pub fn mut_encoded_network(&mut self) -> &mut ::std::vec::Vec<u8> { pub fn mut_mint(&mut self) -> &mut ::std::vec::Vec<u8> {
if self.encoded_network.is_none() { if self.mint.is_none() {
self.encoded_network = ::std::option::Option::Some(::std::vec::Vec::new()); self.mint = ::std::option::Option::Some(::std::vec::Vec::new());
} }
self.encoded_network.as_mut().unwrap() self.mint.as_mut().unwrap()
} }
// Take field // Take field
pub fn take_encoded_network(&mut self) -> ::std::vec::Vec<u8> { pub fn take_mint(&mut self) -> ::std::vec::Vec<u8> {
self.encoded_network.take().unwrap_or_else(|| ::std::vec::Vec::new()) self.mint.take().unwrap_or_else(|| ::std::vec::Vec::new())
} }
// optional bytes encoded_token = 2; // required string symbol = 2;
pub fn encoded_token(&self) -> &[u8] { pub fn symbol(&self) -> &str {
match self.encoded_token.as_ref() { match self.symbol.as_ref() {
Some(v) => v, Some(v) => v,
None => &[], None => "",
} }
} }
pub fn clear_encoded_token(&mut self) { pub fn clear_symbol(&mut self) {
self.encoded_token = ::std::option::Option::None; self.symbol = ::std::option::Option::None;
} }
pub fn has_encoded_token(&self) -> bool { pub fn has_symbol(&self) -> bool {
self.encoded_token.is_some() self.symbol.is_some()
} }
// Param is passed by value, moved // Param is passed by value, moved
pub fn set_encoded_token(&mut self, v: ::std::vec::Vec<u8>) { pub fn set_symbol(&mut self, v: ::std::string::String) {
self.encoded_token = ::std::option::Option::Some(v); self.symbol = ::std::option::Option::Some(v);
} }
// Mutable pointer to the field. // Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first. // If field is not initialized, it is initialized with default value first.
pub fn mut_encoded_token(&mut self) -> &mut ::std::vec::Vec<u8> { pub fn mut_symbol(&mut self) -> &mut ::std::string::String {
if self.encoded_token.is_none() { if self.symbol.is_none() {
self.encoded_token = ::std::option::Option::Some(::std::vec::Vec::new()); self.symbol = ::std::option::Option::Some(::std::string::String::new());
} }
self.encoded_token.as_mut().unwrap() self.symbol.as_mut().unwrap()
} }
// Take field // Take field
pub fn take_encoded_token(&mut self) -> ::std::vec::Vec<u8> { pub fn take_symbol(&mut self) -> ::std::string::String {
self.encoded_token.take().unwrap_or_else(|| ::std::vec::Vec::new()) self.symbol.take().unwrap_or_else(|| ::std::string::String::new())
}
// required string name = 3;
pub fn name(&self) -> &str {
match self.name.as_ref() {
Some(v) => v,
None => "",
}
}
pub fn clear_name(&mut self) {
self.name = ::std::option::Option::None;
}
pub fn has_name(&self) -> bool {
self.name.is_some()
}
// Param is passed by value, moved
pub fn set_name(&mut self, v: ::std::string::String) {
self.name = ::std::option::Option::Some(v);
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_name(&mut self) -> &mut ::std::string::String {
if self.name.is_none() {
self.name = ::std::option::Option::Some(::std::string::String::new());
}
self.name.as_mut().unwrap()
}
// Take field
pub fn take_name(&mut self) -> ::std::string::String {
self.name.take().unwrap_or_else(|| ::std::string::String::new())
} }
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(2); let mut fields = ::std::vec::Vec::with_capacity(3);
let mut oneofs = ::std::vec::Vec::with_capacity(0); let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"encoded_network", "mint",
|m: &EthereumDefinitions| { &m.encoded_network }, |m: &SolanaTokenInfo| { &m.mint },
|m: &mut EthereumDefinitions| { &mut m.encoded_network }, |m: &mut SolanaTokenInfo| { &mut m.mint },
)); ));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"encoded_token", "symbol",
|m: &EthereumDefinitions| { &m.encoded_token }, |m: &SolanaTokenInfo| { &m.symbol },
|m: &mut EthereumDefinitions| { &mut m.encoded_token }, |m: &mut SolanaTokenInfo| { &mut m.symbol },
)); ));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<EthereumDefinitions>( fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"EthereumDefinitions", "name",
|m: &SolanaTokenInfo| { &m.name },
|m: &mut SolanaTokenInfo| { &mut m.name },
));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SolanaTokenInfo>(
"SolanaTokenInfo",
fields, fields,
oneofs, oneofs,
) )
} }
} }
impl ::protobuf::Message for EthereumDefinitions { impl ::protobuf::Message for SolanaTokenInfo {
const NAME: &'static str = "EthereumDefinitions"; const NAME: &'static str = "SolanaTokenInfo";
fn is_initialized(&self) -> bool { fn is_initialized(&self) -> bool {
if self.mint.is_none() {
return false;
}
if self.symbol.is_none() {
return false;
}
if self.name.is_none() {
return false;
}
true true
} }
@ -806,10 +858,13 @@ impl ::protobuf::Message for EthereumDefinitions {
while let Some(tag) = is.read_raw_tag_or_eof()? { while let Some(tag) = is.read_raw_tag_or_eof()? {
match tag { match tag {
10 => { 10 => {
self.encoded_network = ::std::option::Option::Some(is.read_bytes()?); self.mint = ::std::option::Option::Some(is.read_bytes()?);
}, },
18 => { 18 => {
self.encoded_token = ::std::option::Option::Some(is.read_bytes()?); self.symbol = ::std::option::Option::Some(is.read_string()?);
},
26 => {
self.name = ::std::option::Option::Some(is.read_string()?);
}, },
tag => { tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
@ -823,11 +878,14 @@ impl ::protobuf::Message for EthereumDefinitions {
#[allow(unused_variables)] #[allow(unused_variables)]
fn compute_size(&self) -> u64 { fn compute_size(&self) -> u64 {
let mut my_size = 0; let mut my_size = 0;
if let Some(v) = self.encoded_network.as_ref() { if let Some(v) = self.mint.as_ref() {
my_size += ::protobuf::rt::bytes_size(1, &v); my_size += ::protobuf::rt::bytes_size(1, &v);
} }
if let Some(v) = self.encoded_token.as_ref() { if let Some(v) = self.symbol.as_ref() {
my_size += ::protobuf::rt::bytes_size(2, &v); my_size += ::protobuf::rt::string_size(2, &v);
}
if let Some(v) = self.name.as_ref() {
my_size += ::protobuf::rt::string_size(3, &v);
} }
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32); self.special_fields.cached_size().set(my_size as u32);
@ -835,11 +893,14 @@ impl ::protobuf::Message for EthereumDefinitions {
} }
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
if let Some(v) = self.encoded_network.as_ref() { if let Some(v) = self.mint.as_ref() {
os.write_bytes(1, v)?; os.write_bytes(1, v)?;
} }
if let Some(v) = self.encoded_token.as_ref() { if let Some(v) = self.symbol.as_ref() {
os.write_bytes(2, v)?; os.write_string(2, v)?;
}
if let Some(v) = self.name.as_ref() {
os.write_string(3, v)?;
} }
os.write_unknown_fields(self.special_fields.unknown_fields())?; os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(()) ::std::result::Result::Ok(())
@ -853,85 +914,92 @@ impl ::protobuf::Message for EthereumDefinitions {
&mut self.special_fields &mut self.special_fields
} }
fn new() -> EthereumDefinitions { fn new() -> SolanaTokenInfo {
EthereumDefinitions::new() SolanaTokenInfo::new()
} }
fn clear(&mut self) { fn clear(&mut self) {
self.encoded_network = ::std::option::Option::None; self.mint = ::std::option::Option::None;
self.encoded_token = ::std::option::Option::None; self.symbol = ::std::option::Option::None;
self.name = ::std::option::Option::None;
self.special_fields.clear(); self.special_fields.clear();
} }
fn default_instance() -> &'static EthereumDefinitions { fn default_instance() -> &'static SolanaTokenInfo {
static instance: EthereumDefinitions = EthereumDefinitions { static instance: SolanaTokenInfo = SolanaTokenInfo {
encoded_network: ::std::option::Option::None, mint: ::std::option::Option::None,
encoded_token: ::std::option::Option::None, symbol: ::std::option::Option::None,
name: ::std::option::Option::None,
special_fields: ::protobuf::SpecialFields::new(), special_fields: ::protobuf::SpecialFields::new(),
}; };
&instance &instance
} }
} }
impl ::protobuf::MessageFull for EthereumDefinitions { impl ::protobuf::MessageFull for SolanaTokenInfo {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor { fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumDefinitions").unwrap()).clone() descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaTokenInfo").unwrap()).clone()
} }
} }
impl ::std::fmt::Display for EthereumDefinitions { impl ::std::fmt::Display for SolanaTokenInfo {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f) ::protobuf::text_format::fmt(self, f)
} }
} }
impl ::protobuf::reflect::ProtobufValue for EthereumDefinitions { impl ::protobuf::reflect::ProtobufValue for SolanaTokenInfo {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
} }
#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)]
// @@protoc_insertion_point(enum:hw.trezor.messages.ethereum_definitions.EthereumDefinitionType) // @@protoc_insertion_point(enum:hw.trezor.messages.definitions.DefinitionType)
pub enum EthereumDefinitionType { pub enum DefinitionType {
// @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_definitions.EthereumDefinitionType.NETWORK) // @@protoc_insertion_point(enum_value:hw.trezor.messages.definitions.DefinitionType.ETHEREUM_NETWORK)
NETWORK = 0, ETHEREUM_NETWORK = 0,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_definitions.EthereumDefinitionType.TOKEN) // @@protoc_insertion_point(enum_value:hw.trezor.messages.definitions.DefinitionType.ETHEREUM_TOKEN)
TOKEN = 1, ETHEREUM_TOKEN = 1,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.definitions.DefinitionType.SOLANA_TOKEN)
SOLANA_TOKEN = 2,
} }
impl ::protobuf::Enum for EthereumDefinitionType { impl ::protobuf::Enum for DefinitionType {
const NAME: &'static str = "EthereumDefinitionType"; const NAME: &'static str = "DefinitionType";
fn value(&self) -> i32 { fn value(&self) -> i32 {
*self as i32 *self as i32
} }
fn from_i32(value: i32) -> ::std::option::Option<EthereumDefinitionType> { fn from_i32(value: i32) -> ::std::option::Option<DefinitionType> {
match value { match value {
0 => ::std::option::Option::Some(EthereumDefinitionType::NETWORK), 0 => ::std::option::Option::Some(DefinitionType::ETHEREUM_NETWORK),
1 => ::std::option::Option::Some(EthereumDefinitionType::TOKEN), 1 => ::std::option::Option::Some(DefinitionType::ETHEREUM_TOKEN),
2 => ::std::option::Option::Some(DefinitionType::SOLANA_TOKEN),
_ => ::std::option::Option::None _ => ::std::option::Option::None
} }
} }
fn from_str(str: &str) -> ::std::option::Option<EthereumDefinitionType> { fn from_str(str: &str) -> ::std::option::Option<DefinitionType> {
match str { match str {
"NETWORK" => ::std::option::Option::Some(EthereumDefinitionType::NETWORK), "ETHEREUM_NETWORK" => ::std::option::Option::Some(DefinitionType::ETHEREUM_NETWORK),
"TOKEN" => ::std::option::Option::Some(EthereumDefinitionType::TOKEN), "ETHEREUM_TOKEN" => ::std::option::Option::Some(DefinitionType::ETHEREUM_TOKEN),
"SOLANA_TOKEN" => ::std::option::Option::Some(DefinitionType::SOLANA_TOKEN),
_ => ::std::option::Option::None _ => ::std::option::Option::None
} }
} }
const VALUES: &'static [EthereumDefinitionType] = &[ const VALUES: &'static [DefinitionType] = &[
EthereumDefinitionType::NETWORK, DefinitionType::ETHEREUM_NETWORK,
EthereumDefinitionType::TOKEN, DefinitionType::ETHEREUM_TOKEN,
DefinitionType::SOLANA_TOKEN,
]; ];
} }
impl ::protobuf::EnumFull for EthereumDefinitionType { impl ::protobuf::EnumFull for DefinitionType {
fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().enum_by_package_relative_name("EthereumDefinitionType").unwrap()).clone() descriptor.get(|| file_descriptor().enum_by_package_relative_name("DefinitionType").unwrap()).clone()
} }
fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor {
@ -940,32 +1008,33 @@ impl ::protobuf::EnumFull for EthereumDefinitionType {
} }
} }
impl ::std::default::Default for EthereumDefinitionType { impl ::std::default::Default for DefinitionType {
fn default() -> Self { fn default() -> Self {
EthereumDefinitionType::NETWORK DefinitionType::ETHEREUM_NETWORK
} }
} }
impl EthereumDefinitionType { impl DefinitionType {
fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData {
::protobuf::reflect::GeneratedEnumDescriptorData::new::<EthereumDefinitionType>("EthereumDefinitionType") ::protobuf::reflect::GeneratedEnumDescriptorData::new::<DefinitionType>("DefinitionType")
} }
} }
static file_descriptor_proto_data: &'static [u8] = b"\ static file_descriptor_proto_data: &'static [u8] = b"\
\n#messages-ethereum-definitions.proto\x12'hw.trezor.messages.ethereum_d\ \n\x1amessages-definitions.proto\x12\x1ehw.trezor.messages.definitions\"\
efinitions\"t\n\x13EthereumNetworkInfo\x12\x19\n\x08chain_id\x18\x01\x20\ t\n\x13EthereumNetworkInfo\x12\x19\n\x08chain_id\x18\x01\x20\x02(\x04R\
\x02(\x04R\x07chainId\x12\x16\n\x06symbol\x18\x02\x20\x02(\tR\x06symbol\ \x07chainId\x12\x16\n\x06symbol\x18\x02\x20\x02(\tR\x06symbol\x12\x16\n\
\x12\x16\n\x06slip44\x18\x03\x20\x02(\rR\x06slip44\x12\x12\n\x04name\x18\ \x06slip44\x18\x03\x20\x02(\rR\x06slip44\x12\x12\n\x04name\x18\x04\x20\
\x04\x20\x02(\tR\x04name\"\x90\x01\n\x11EthereumTokenInfo\x12\x18\n\x07a\ \x02(\tR\x04name\"\x90\x01\n\x11EthereumTokenInfo\x12\x18\n\x07address\
ddress\x18\x01\x20\x02(\x0cR\x07address\x12\x19\n\x08chain_id\x18\x02\ \x18\x01\x20\x02(\x0cR\x07address\x12\x19\n\x08chain_id\x18\x02\x20\x02(\
\x20\x02(\x04R\x07chainId\x12\x16\n\x06symbol\x18\x03\x20\x02(\tR\x06sym\ \x04R\x07chainId\x12\x16\n\x06symbol\x18\x03\x20\x02(\tR\x06symbol\x12\
bol\x12\x1a\n\x08decimals\x18\x04\x20\x02(\rR\x08decimals\x12\x12\n\x04n\ \x1a\n\x08decimals\x18\x04\x20\x02(\rR\x08decimals\x12\x12\n\x04name\x18\
ame\x18\x05\x20\x02(\tR\x04name\"c\n\x13EthereumDefinitions\x12'\n\x0fen\ \x05\x20\x02(\tR\x04name\"Q\n\x0fSolanaTokenInfo\x12\x12\n\x04mint\x18\
coded_network\x18\x01\x20\x01(\x0cR\x0eencodedNetwork\x12#\n\rencoded_to\ \x01\x20\x02(\x0cR\x04mint\x12\x16\n\x06symbol\x18\x02\x20\x02(\tR\x06sy\
ken\x18\x02\x20\x01(\x0cR\x0cencodedToken*0\n\x16EthereumDefinitionType\ mbol\x12\x12\n\x04name\x18\x03\x20\x02(\tR\x04name*L\n\x0eDefinitionType\
\x12\x0b\n\x07NETWORK\x10\0\x12\t\n\x05TOKEN\x10\x01BG\n#com.satoshilabs\ \x12\x14\n\x10ETHEREUM_NETWORK\x10\0\x12\x12\n\x0eETHEREUM_TOKEN\x10\x01\
.trezor.lib.protobufB\x20TrezorMessageEthereumDefinitions\ \x12\x10\n\x0cSOLANA_TOKEN\x10\x02B?\n#com.satoshilabs.trezor.lib.protob\
ufB\x18TrezorMessageDefinitions\
"; ";
/// `FileDescriptorProto` object which was a source for this generated file /// `FileDescriptorProto` object which was a source for this generated file
@ -986,9 +1055,9 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
let mut messages = ::std::vec::Vec::with_capacity(3); let mut messages = ::std::vec::Vec::with_capacity(3);
messages.push(EthereumNetworkInfo::generated_message_descriptor_data()); messages.push(EthereumNetworkInfo::generated_message_descriptor_data());
messages.push(EthereumTokenInfo::generated_message_descriptor_data()); messages.push(EthereumTokenInfo::generated_message_descriptor_data());
messages.push(EthereumDefinitions::generated_message_descriptor_data()); messages.push(SolanaTokenInfo::generated_message_descriptor_data());
let mut enums = ::std::vec::Vec::with_capacity(1); let mut enums = ::std::vec::Vec::with_capacity(1);
enums.push(EthereumDefinitionType::generated_enum_descriptor_data()); enums.push(DefinitionType::generated_enum_descriptor_data());
::protobuf::reflect::GeneratedFileDescriptor::new_generated( ::protobuf::reflect::GeneratedFileDescriptor::new_generated(
file_descriptor_proto(), file_descriptor_proto(),
deps, deps,

View File

@ -865,7 +865,7 @@ pub struct EthereumSignTx {
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.tx_type) // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.tx_type)
pub tx_type: ::std::option::Option<u32>, pub tx_type: ::std::option::Option<u32>,
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.definitions) // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.definitions)
pub definitions: ::protobuf::MessageField<super::messages_ethereum_definitions::EthereumDefinitions>, pub definitions: ::protobuf::MessageField<EthereumDefinitions>,
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.chunkify) // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.chunkify)
pub chunkify: ::std::option::Option<bool>, pub chunkify: ::std::option::Option<bool>,
// special fields // special fields
@ -1229,7 +1229,7 @@ impl EthereumSignTx {
|m: &EthereumSignTx| { &m.tx_type }, |m: &EthereumSignTx| { &m.tx_type },
|m: &mut EthereumSignTx| { &mut m.tx_type }, |m: &mut EthereumSignTx| { &mut m.tx_type },
)); ));
fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_ethereum_definitions::EthereumDefinitions>( fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EthereumDefinitions>(
"definitions", "definitions",
|m: &EthereumSignTx| { &m.definitions }, |m: &EthereumSignTx| { &m.definitions },
|m: &mut EthereumSignTx| { &mut m.definitions }, |m: &mut EthereumSignTx| { &mut m.definitions },
@ -1497,7 +1497,7 @@ pub struct EthereumSignTxEIP1559 {
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.access_list) // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.access_list)
pub access_list: ::std::vec::Vec<ethereum_sign_tx_eip1559::EthereumAccessList>, pub access_list: ::std::vec::Vec<ethereum_sign_tx_eip1559::EthereumAccessList>,
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.definitions) // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.definitions)
pub definitions: ::protobuf::MessageField<super::messages_ethereum_definitions::EthereumDefinitions>, pub definitions: ::protobuf::MessageField<EthereumDefinitions>,
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.chunkify) // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.chunkify)
pub chunkify: ::std::option::Option<bool>, pub chunkify: ::std::option::Option<bool>,
// special fields // special fields
@ -1883,7 +1883,7 @@ impl EthereumSignTxEIP1559 {
|m: &EthereumSignTxEIP1559| { &m.access_list }, |m: &EthereumSignTxEIP1559| { &m.access_list },
|m: &mut EthereumSignTxEIP1559| { &mut m.access_list }, |m: &mut EthereumSignTxEIP1559| { &mut m.access_list },
)); ));
fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_ethereum_definitions::EthereumDefinitions>( fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EthereumDefinitions>(
"definitions", "definitions",
|m: &EthereumSignTxEIP1559| { &m.definitions }, |m: &EthereumSignTxEIP1559| { &m.definitions },
|m: &mut EthereumSignTxEIP1559| { &mut m.definitions }, |m: &mut EthereumSignTxEIP1559| { &mut m.definitions },
@ -4093,65 +4093,279 @@ impl ::protobuf::reflect::ProtobufValue for EthereumTypedDataSignature {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
} }
// @@protoc_insertion_point(message:hw.trezor.messages.ethereum.EthereumDefinitions)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct EthereumDefinitions {
// message fields
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumDefinitions.encoded_network)
pub encoded_network: ::std::option::Option<::std::vec::Vec<u8>>,
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumDefinitions.encoded_token)
pub encoded_token: ::std::option::Option<::std::vec::Vec<u8>>,
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumDefinitions.special_fields)
pub special_fields: ::protobuf::SpecialFields,
}
impl<'a> ::std::default::Default for &'a EthereumDefinitions {
fn default() -> &'a EthereumDefinitions {
<EthereumDefinitions as ::protobuf::Message>::default_instance()
}
}
impl EthereumDefinitions {
pub fn new() -> EthereumDefinitions {
::std::default::Default::default()
}
// optional bytes encoded_network = 1;
pub fn encoded_network(&self) -> &[u8] {
match self.encoded_network.as_ref() {
Some(v) => v,
None => &[],
}
}
pub fn clear_encoded_network(&mut self) {
self.encoded_network = ::std::option::Option::None;
}
pub fn has_encoded_network(&self) -> bool {
self.encoded_network.is_some()
}
// Param is passed by value, moved
pub fn set_encoded_network(&mut self, v: ::std::vec::Vec<u8>) {
self.encoded_network = ::std::option::Option::Some(v);
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_encoded_network(&mut self) -> &mut ::std::vec::Vec<u8> {
if self.encoded_network.is_none() {
self.encoded_network = ::std::option::Option::Some(::std::vec::Vec::new());
}
self.encoded_network.as_mut().unwrap()
}
// Take field
pub fn take_encoded_network(&mut self) -> ::std::vec::Vec<u8> {
self.encoded_network.take().unwrap_or_else(|| ::std::vec::Vec::new())
}
// optional bytes encoded_token = 2;
pub fn encoded_token(&self) -> &[u8] {
match self.encoded_token.as_ref() {
Some(v) => v,
None => &[],
}
}
pub fn clear_encoded_token(&mut self) {
self.encoded_token = ::std::option::Option::None;
}
pub fn has_encoded_token(&self) -> bool {
self.encoded_token.is_some()
}
// Param is passed by value, moved
pub fn set_encoded_token(&mut self, v: ::std::vec::Vec<u8>) {
self.encoded_token = ::std::option::Option::Some(v);
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_encoded_token(&mut self) -> &mut ::std::vec::Vec<u8> {
if self.encoded_token.is_none() {
self.encoded_token = ::std::option::Option::Some(::std::vec::Vec::new());
}
self.encoded_token.as_mut().unwrap()
}
// Take field
pub fn take_encoded_token(&mut self) -> ::std::vec::Vec<u8> {
self.encoded_token.take().unwrap_or_else(|| ::std::vec::Vec::new())
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(2);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"encoded_network",
|m: &EthereumDefinitions| { &m.encoded_network },
|m: &mut EthereumDefinitions| { &mut m.encoded_network },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"encoded_token",
|m: &EthereumDefinitions| { &m.encoded_token },
|m: &mut EthereumDefinitions| { &mut m.encoded_token },
));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<EthereumDefinitions>(
"EthereumDefinitions",
fields,
oneofs,
)
}
}
impl ::protobuf::Message for EthereumDefinitions {
const NAME: &'static str = "EthereumDefinitions";
fn is_initialized(&self) -> bool {
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
while let Some(tag) = is.read_raw_tag_or_eof()? {
match tag {
10 => {
self.encoded_network = ::std::option::Option::Some(is.read_bytes()?);
},
18 => {
self.encoded_token = ::std::option::Option::Some(is.read_bytes()?);
},
tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u64 {
let mut my_size = 0;
if let Some(v) = self.encoded_network.as_ref() {
my_size += ::protobuf::rt::bytes_size(1, &v);
}
if let Some(v) = self.encoded_token.as_ref() {
my_size += ::protobuf::rt::bytes_size(2, &v);
}
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
if let Some(v) = self.encoded_network.as_ref() {
os.write_bytes(1, v)?;
}
if let Some(v) = self.encoded_token.as_ref() {
os.write_bytes(2, v)?;
}
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
fn special_fields(&self) -> &::protobuf::SpecialFields {
&self.special_fields
}
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
&mut self.special_fields
}
fn new() -> EthereumDefinitions {
EthereumDefinitions::new()
}
fn clear(&mut self) {
self.encoded_network = ::std::option::Option::None;
self.encoded_token = ::std::option::Option::None;
self.special_fields.clear();
}
fn default_instance() -> &'static EthereumDefinitions {
static instance: EthereumDefinitions = EthereumDefinitions {
encoded_network: ::std::option::Option::None,
encoded_token: ::std::option::Option::None,
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
}
}
impl ::protobuf::MessageFull for EthereumDefinitions {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("EthereumDefinitions").unwrap()).clone()
}
}
impl ::std::fmt::Display for EthereumDefinitions {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for EthereumDefinitions {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
static file_descriptor_proto_data: &'static [u8] = b"\ static file_descriptor_proto_data: &'static [u8] = b"\
\n\x17messages-ethereum.proto\x12\x1bhw.trezor.messages.ethereum\x1a\x15\ \n\x17messages-ethereum.proto\x12\x1bhw.trezor.messages.ethereum\x1a\x15\
messages-common.proto\x1a#messages-ethereum-definitions.proto\"V\n\x14Et\ messages-common.proto\"V\n\x14EthereumGetPublicKey\x12\x1b\n\taddress_n\
hereumGetPublicKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ \x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0cshow_display\x18\x02\x20\x01(\
\x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\"b\n\x11Eth\ \x08R\x0bshowDisplay\"b\n\x11EthereumPublicKey\x129\n\x04node\x18\x01\
ereumPublicKey\x129\n\x04node\x18\x01\x20\x02(\x0b2%.hw.trezor.messages.\ \x20\x02(\x0b2%.hw.trezor.messages.common.HDNodeTypeR\x04node\x12\x12\n\
common.HDNodeTypeR\x04node\x12\x12\n\x04xpub\x18\x02\x20\x02(\tR\x04xpub\ \x04xpub\x18\x02\x20\x02(\tR\x04xpub\"\x99\x01\n\x12EthereumGetAddress\
\"\x99\x01\n\x12EthereumGetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\ \x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0cshow_dis\
\rR\x08addressN\x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisp\ play\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12'\n\x0fencoded_network\x18\
lay\x12'\n\x0fencoded_network\x18\x03\x20\x01(\x0cR\x0eencodedNetwork\ \x03\x20\x01(\x0cR\x0eencodedNetwork\x12\x1a\n\x08chunkify\x18\x04\x20\
\x12\x1a\n\x08chunkify\x18\x04\x20\x01(\x08R\x08chunkify\"Q\n\x0fEthereu\ \x01(\x08R\x08chunkify\"Q\n\x0fEthereumAddress\x12$\n\x0c_old_address\
mAddress\x12$\n\x0c_old_address\x18\x01\x20\x01(\x0cR\nOldAddressB\x02\ \x18\x01\x20\x01(\x0cR\nOldAddressB\x02\x18\x01\x12\x18\n\x07address\x18\
\x18\x01\x12\x18\n\x07address\x18\x02\x20\x01(\tR\x07address\"\xad\x03\n\ \x02\x20\x01(\tR\x07address\"\xa1\x03\n\x0eEthereumSignTx\x12\x1b\n\tadd\
\x0eEthereumSignTx\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ ress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x16\n\x05nonce\x18\x02\x20\
\x12\x16\n\x05nonce\x18\x02\x20\x01(\x0c:\0R\x05nonce\x12\x1b\n\tgas_pri\ \x01(\x0c:\0R\x05nonce\x12\x1b\n\tgas_price\x18\x03\x20\x02(\x0cR\x08gas\
ce\x18\x03\x20\x02(\x0cR\x08gasPrice\x12\x1b\n\tgas_limit\x18\x04\x20\ Price\x12\x1b\n\tgas_limit\x18\x04\x20\x02(\x0cR\x08gasLimit\x12\x10\n\
\x02(\x0cR\x08gasLimit\x12\x10\n\x02to\x18\x0b\x20\x01(\t:\0R\x02to\x12\ \x02to\x18\x0b\x20\x01(\t:\0R\x02to\x12\x16\n\x05value\x18\x06\x20\x01(\
\x16\n\x05value\x18\x06\x20\x01(\x0c:\0R\x05value\x12.\n\x12data_initial\ \x0c:\0R\x05value\x12.\n\x12data_initial_chunk\x18\x07\x20\x01(\x0c:\0R\
_chunk\x18\x07\x20\x01(\x0c:\0R\x10dataInitialChunk\x12\"\n\x0bdata_leng\ \x10dataInitialChunk\x12\"\n\x0bdata_length\x18\x08\x20\x01(\r:\x010R\nd\
th\x18\x08\x20\x01(\r:\x010R\ndataLength\x12\x19\n\x08chain_id\x18\t\x20\ ataLength\x12\x19\n\x08chain_id\x18\t\x20\x02(\x04R\x07chainId\x12\x17\n\
\x02(\x04R\x07chainId\x12\x17\n\x07tx_type\x18\n\x20\x01(\rR\x06txType\ \x07tx_type\x18\n\x20\x01(\rR\x06txType\x12R\n\x0bdefinitions\x18\x0c\
\x12^\n\x0bdefinitions\x18\x0c\x20\x01(\x0b2<.hw.trezor.messages.ethereu\ \x20\x01(\x0b20.hw.trezor.messages.ethereum.EthereumDefinitionsR\x0bdefi\
m_definitions.EthereumDefinitionsR\x0bdefinitions\x12\x1a\n\x08chunkify\ nitions\x12\x1a\n\x08chunkify\x18\r\x20\x01(\x08R\x08chunkify\"\xf0\x04\
\x18\r\x20\x01(\x08R\x08chunkify\"\xfc\x04\n\x15EthereumSignTxEIP1559\ \n\x15EthereumSignTxEIP1559\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08\
\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x14\n\x05nonce\ addressN\x12\x14\n\x05nonce\x18\x02\x20\x02(\x0cR\x05nonce\x12\x1e\n\x0b\
\x18\x02\x20\x02(\x0cR\x05nonce\x12\x1e\n\x0bmax_gas_fee\x18\x03\x20\x02\ max_gas_fee\x18\x03\x20\x02(\x0cR\tmaxGasFee\x12(\n\x10max_priority_fee\
(\x0cR\tmaxGasFee\x12(\n\x10max_priority_fee\x18\x04\x20\x02(\x0cR\x0ema\ \x18\x04\x20\x02(\x0cR\x0emaxPriorityFee\x12\x1b\n\tgas_limit\x18\x05\
xPriorityFee\x12\x1b\n\tgas_limit\x18\x05\x20\x02(\x0cR\x08gasLimit\x12\ \x20\x02(\x0cR\x08gasLimit\x12\x10\n\x02to\x18\x06\x20\x01(\t:\0R\x02to\
\x10\n\x02to\x18\x06\x20\x01(\t:\0R\x02to\x12\x14\n\x05value\x18\x07\x20\ \x12\x14\n\x05value\x18\x07\x20\x02(\x0cR\x05value\x12.\n\x12data_initia\
\x02(\x0cR\x05value\x12.\n\x12data_initial_chunk\x18\x08\x20\x01(\x0c:\0\ l_chunk\x18\x08\x20\x01(\x0c:\0R\x10dataInitialChunk\x12\x1f\n\x0bdata_l\
R\x10dataInitialChunk\x12\x1f\n\x0bdata_length\x18\t\x20\x02(\rR\ndataLe\ ength\x18\t\x20\x02(\rR\ndataLength\x12\x19\n\x08chain_id\x18\n\x20\x02(\
ngth\x12\x19\n\x08chain_id\x18\n\x20\x02(\x04R\x07chainId\x12f\n\x0bacce\ \x04R\x07chainId\x12f\n\x0baccess_list\x18\x0b\x20\x03(\x0b2E.hw.trezor.\
ss_list\x18\x0b\x20\x03(\x0b2E.hw.trezor.messages.ethereum.EthereumSignT\ messages.ethereum.EthereumSignTxEIP1559.EthereumAccessListR\naccessList\
xEIP1559.EthereumAccessListR\naccessList\x12^\n\x0bdefinitions\x18\x0c\ \x12R\n\x0bdefinitions\x18\x0c\x20\x01(\x0b20.hw.trezor.messages.ethereu\
\x20\x01(\x0b2<.hw.trezor.messages.ethereum_definitions.EthereumDefiniti\ m.EthereumDefinitionsR\x0bdefinitions\x12\x1a\n\x08chunkify\x18\r\x20\
onsR\x0bdefinitions\x12\x1a\n\x08chunkify\x18\r\x20\x01(\x08R\x08chunkif\ \x01(\x08R\x08chunkify\x1aQ\n\x12EthereumAccessList\x12\x18\n\x07address\
y\x1aQ\n\x12EthereumAccessList\x12\x18\n\x07address\x18\x01\x20\x02(\tR\ \x18\x01\x20\x02(\tR\x07address\x12!\n\x0cstorage_keys\x18\x02\x20\x03(\
\x07address\x12!\n\x0cstorage_keys\x18\x02\x20\x03(\x0cR\x0bstorageKeys\ \x0cR\x0bstorageKeys\"\x97\x01\n\x11EthereumTxRequest\x12\x1f\n\x0bdata_\
\"\x97\x01\n\x11EthereumTxRequest\x12\x1f\n\x0bdata_length\x18\x01\x20\ length\x18\x01\x20\x01(\rR\ndataLength\x12\x1f\n\x0bsignature_v\x18\x02\
\x01(\rR\ndataLength\x12\x1f\n\x0bsignature_v\x18\x02\x20\x01(\rR\nsigna\ \x20\x01(\rR\nsignatureV\x12\x1f\n\x0bsignature_r\x18\x03\x20\x01(\x0cR\
tureV\x12\x1f\n\x0bsignature_r\x18\x03\x20\x01(\x0cR\nsignatureR\x12\x1f\ \nsignatureR\x12\x1f\n\x0bsignature_s\x18\x04\x20\x01(\x0cR\nsignatureS\
\n\x0bsignature_s\x18\x04\x20\x01(\x0cR\nsignatureS\".\n\rEthereumTxAck\ \".\n\rEthereumTxAck\x12\x1d\n\ndata_chunk\x18\x01\x20\x02(\x0cR\tdataCh\
\x12\x1d\n\ndata_chunk\x18\x01\x20\x02(\x0cR\tdataChunk\"\x91\x01\n\x13E\ unk\"\x91\x01\n\x13EthereumSignMessage\x12\x1b\n\taddress_n\x18\x01\x20\
thereumSignMessage\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ \x03(\rR\x08addressN\x12\x18\n\x07message\x18\x02\x20\x02(\x0cR\x07messa\
\x12\x18\n\x07message\x18\x02\x20\x02(\x0cR\x07message\x12'\n\x0fencoded\ ge\x12'\n\x0fencoded_network\x18\x03\x20\x01(\x0cR\x0eencodedNetwork\x12\
_network\x18\x03\x20\x01(\x0cR\x0eencodedNetwork\x12\x1a\n\x08chunkify\ \x1a\n\x08chunkify\x18\x04\x20\x01(\x08R\x08chunkify\"R\n\x18EthereumMes\
\x18\x04\x20\x01(\x08R\x08chunkify\"R\n\x18EthereumMessageSignature\x12\ sageSignature\x12\x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\
\x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07address\ \x18\n\x07address\x18\x03\x20\x02(\tR\x07address\"\x85\x01\n\x15Ethereum\
\x18\x03\x20\x02(\tR\x07address\"\x85\x01\n\x15EthereumVerifyMessage\x12\ VerifyMessage\x12\x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\
\x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07message\ \x18\n\x07message\x18\x03\x20\x02(\x0cR\x07message\x12\x18\n\x07address\
\x18\x03\x20\x02(\x0cR\x07message\x12\x18\n\x07address\x18\x04\x20\x02(\ \x18\x04\x20\x02(\tR\x07address\x12\x1a\n\x08chunkify\x18\x05\x20\x01(\
\tR\x07address\x12\x1a\n\x08chunkify\x18\x05\x20\x01(\x08R\x08chunkify\"\ \x08R\x08chunkify\"\xb4\x01\n\x15EthereumSignTypedHash\x12\x1b\n\taddres\
\xb4\x01\n\x15EthereumSignTypedHash\x12\x1b\n\taddress_n\x18\x01\x20\x03\ s_n\x18\x01\x20\x03(\rR\x08addressN\x122\n\x15domain_separator_hash\x18\
(\rR\x08addressN\x122\n\x15domain_separator_hash\x18\x02\x20\x02(\x0cR\ \x02\x20\x02(\x0cR\x13domainSeparatorHash\x12!\n\x0cmessage_hash\x18\x03\
\x13domainSeparatorHash\x12!\n\x0cmessage_hash\x18\x03\x20\x01(\x0cR\x0b\ \x20\x01(\x0cR\x0bmessageHash\x12'\n\x0fencoded_network\x18\x04\x20\x01(\
messageHash\x12'\n\x0fencoded_network\x18\x04\x20\x01(\x0cR\x0eencodedNe\ \x0cR\x0eencodedNetwork\"T\n\x1aEthereumTypedDataSignature\x12\x1c\n\tsi\
twork\"T\n\x1aEthereumTypedDataSignature\x12\x1c\n\tsignature\x18\x01\ gnature\x18\x01\x20\x02(\x0cR\tsignature\x12\x18\n\x07address\x18\x02\
\x20\x02(\x0cR\tsignature\x12\x18\n\x07address\x18\x02\x20\x02(\tR\x07ad\ \x20\x02(\tR\x07address\"c\n\x13EthereumDefinitions\x12'\n\x0fencoded_ne\
dressB<\n#com.satoshilabs.trezor.lib.protobufB\x15TrezorMessageEthereum\ twork\x18\x01\x20\x01(\x0cR\x0eencodedNetwork\x12#\n\rencoded_token\x18\
\x02\x20\x01(\x0cR\x0cencodedTokenB<\n#com.satoshilabs.trezor.lib.protob\
ufB\x15TrezorMessageEthereum\
"; ";
/// `FileDescriptorProto` object which was a source for this generated file /// `FileDescriptorProto` object which was a source for this generated file
@ -4168,10 +4382,9 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new();
file_descriptor.get(|| { file_descriptor.get(|| {
let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| {
let mut deps = ::std::vec::Vec::with_capacity(2); let mut deps = ::std::vec::Vec::with_capacity(1);
deps.push(super::messages_common::file_descriptor().clone()); deps.push(super::messages_common::file_descriptor().clone());
deps.push(super::messages_ethereum_definitions::file_descriptor().clone()); let mut messages = ::std::vec::Vec::with_capacity(15);
let mut messages = ::std::vec::Vec::with_capacity(14);
messages.push(EthereumGetPublicKey::generated_message_descriptor_data()); messages.push(EthereumGetPublicKey::generated_message_descriptor_data());
messages.push(EthereumPublicKey::generated_message_descriptor_data()); messages.push(EthereumPublicKey::generated_message_descriptor_data());
messages.push(EthereumGetAddress::generated_message_descriptor_data()); messages.push(EthereumGetAddress::generated_message_descriptor_data());
@ -4185,6 +4398,7 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
messages.push(EthereumVerifyMessage::generated_message_descriptor_data()); messages.push(EthereumVerifyMessage::generated_message_descriptor_data());
messages.push(EthereumSignTypedHash::generated_message_descriptor_data()); messages.push(EthereumSignTypedHash::generated_message_descriptor_data());
messages.push(EthereumTypedDataSignature::generated_message_descriptor_data()); messages.push(EthereumTypedDataSignature::generated_message_descriptor_data());
messages.push(EthereumDefinitions::generated_message_descriptor_data());
messages.push(ethereum_sign_tx_eip1559::EthereumAccessList::generated_message_descriptor_data()); messages.push(ethereum_sign_tx_eip1559::EthereumAccessList::generated_message_descriptor_data());
let mut enums = ::std::vec::Vec::with_capacity(0); let mut enums = ::std::vec::Vec::with_capacity(0);
::protobuf::reflect::GeneratedFileDescriptor::new_generated( ::protobuf::reflect::GeneratedFileDescriptor::new_generated(

View File

@ -36,7 +36,7 @@ pub struct EthereumSignTypedData {
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.metamask_v4_compat) // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.metamask_v4_compat)
pub metamask_v4_compat: ::std::option::Option<bool>, pub metamask_v4_compat: ::std::option::Option<bool>,
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.definitions) // @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.definitions)
pub definitions: ::protobuf::MessageField<super::messages_ethereum_definitions::EthereumDefinitions>, pub definitions: ::protobuf::MessageField<super::messages_ethereum::EthereumDefinitions>,
// special fields // special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.special_fields) // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.special_fields)
pub special_fields: ::protobuf::SpecialFields, pub special_fields: ::protobuf::SpecialFields,
@ -126,7 +126,7 @@ impl EthereumSignTypedData {
|m: &EthereumSignTypedData| { &m.metamask_v4_compat }, |m: &EthereumSignTypedData| { &m.metamask_v4_compat },
|m: &mut EthereumSignTypedData| { &mut m.metamask_v4_compat }, |m: &mut EthereumSignTypedData| { &mut m.metamask_v4_compat },
)); ));
fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_ethereum_definitions::EthereumDefinitions>( fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_ethereum::EthereumDefinitions>(
"definitions", "definitions",
|m: &EthereumSignTypedData| { &m.definitions }, |m: &EthereumSignTypedData| { &m.definitions },
|m: &mut EthereumSignTypedData| { &mut m.definitions }, |m: &mut EthereumSignTypedData| { &mut m.definitions },
@ -1400,31 +1400,31 @@ impl ::protobuf::reflect::ProtobufValue for EthereumTypedDataValueAck {
static file_descriptor_proto_data: &'static [u8] = b"\ static file_descriptor_proto_data: &'static [u8] = b"\
\n\x1emessages-ethereum-eip712.proto\x12\"hw.trezor.messages.ethereum_ei\ \n\x1emessages-ethereum-eip712.proto\x12\"hw.trezor.messages.ethereum_ei\
p712\x1a#messages-ethereum-definitions.proto\"\xeb\x01\n\x15EthereumSign\ p712\x1a\x17messages-ethereum.proto\"\xdf\x01\n\x15EthereumSignTypedData\
TypedData\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\ \x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0cprimary_\
\x0cprimary_type\x18\x02\x20\x02(\tR\x0bprimaryType\x122\n\x12metamask_v\ type\x18\x02\x20\x02(\tR\x0bprimaryType\x122\n\x12metamask_v4_compat\x18\
4_compat\x18\x03\x20\x01(\x08:\x04trueR\x10metamaskV4Compat\x12^\n\x0bde\ \x03\x20\x01(\x08:\x04trueR\x10metamaskV4Compat\x12R\n\x0bdefinitions\
finitions\x18\x04\x20\x01(\x0b2<.hw.trezor.messages.ethereum_definitions\ \x18\x04\x20\x01(\x0b20.hw.trezor.messages.ethereum.EthereumDefinitionsR\
.EthereumDefinitionsR\x0bdefinitions\"4\n\x1eEthereumTypedDataStructRequ\ \x0bdefinitions\"4\n\x1eEthereumTypedDataStructRequest\x12\x12\n\x04name\
est\x12\x12\n\x04name\x18\x01\x20\x02(\tR\x04name\"\xb4\x05\n\x1aEthereu\ \x18\x01\x20\x02(\tR\x04name\"\xb4\x05\n\x1aEthereumTypedDataStructAck\
mTypedDataStructAck\x12m\n\x07members\x18\x01\x20\x03(\x0b2S.hw.trezor.m\ \x12m\n\x07members\x18\x01\x20\x03(\x0b2S.hw.trezor.messages.ethereum_ei\
essages.ethereum_eip712.EthereumTypedDataStructAck.EthereumStructMemberR\ p712.EthereumTypedDataStructAck.EthereumStructMemberR\x07members\x1a\x90\
\x07members\x1a\x90\x01\n\x14EthereumStructMember\x12d\n\x04type\x18\x01\ \x01\n\x14EthereumStructMember\x12d\n\x04type\x18\x01\x20\x02(\x0b2P.hw.\
\x20\x02(\x0b2P.hw.trezor.messages.ethereum_eip712.EthereumTypedDataStru\ trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumField\
ctAck.EthereumFieldTypeR\x04type\x12\x12\n\x04name\x18\x02\x20\x02(\tR\ TypeR\x04type\x12\x12\n\x04name\x18\x02\x20\x02(\tR\x04name\x1a\xa7\x02\
\x04name\x1a\xa7\x02\n\x11EthereumFieldType\x12l\n\tdata_type\x18\x01\ \n\x11EthereumFieldType\x12l\n\tdata_type\x18\x01\x20\x02(\x0e2O.hw.trez\
\x20\x02(\x0e2O.hw.trezor.messages.ethereum_eip712.EthereumTypedDataStru\ or.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataTypeR\
ctAck.EthereumDataTypeR\x08dataType\x12\x12\n\x04size\x18\x02\x20\x01(\r\ \x08dataType\x12\x12\n\x04size\x18\x02\x20\x01(\rR\x04size\x12o\n\nentry\
R\x04size\x12o\n\nentry_type\x18\x03\x20\x01(\x0b2P.hw.trezor.messages.e\ _type\x18\x03\x20\x01(\x0b2P.hw.trezor.messages.ethereum_eip712.Ethereum\
thereum_eip712.EthereumTypedDataStructAck.EthereumFieldTypeR\tentryType\ TypedDataStructAck.EthereumFieldTypeR\tentryType\x12\x1f\n\x0bstruct_nam\
\x12\x1f\n\x0bstruct_name\x18\x04\x20\x01(\tR\nstructName\"j\n\x10Ethere\ e\x18\x04\x20\x01(\tR\nstructName\"j\n\x10EthereumDataType\x12\x08\n\x04\
umDataType\x12\x08\n\x04UINT\x10\x01\x12\x07\n\x03INT\x10\x02\x12\t\n\ UINT\x10\x01\x12\x07\n\x03INT\x10\x02\x12\t\n\x05BYTES\x10\x03\x12\n\n\
\x05BYTES\x10\x03\x12\n\n\x06STRING\x10\x04\x12\x08\n\x04BOOL\x10\x05\ \x06STRING\x10\x04\x12\x08\n\x04BOOL\x10\x05\x12\x0b\n\x07ADDRESS\x10\
\x12\x0b\n\x07ADDRESS\x10\x06\x12\t\n\x05ARRAY\x10\x07\x12\n\n\x06STRUCT\ \x06\x12\t\n\x05ARRAY\x10\x07\x12\n\n\x06STRUCT\x10\x08\"@\n\x1dEthereum\
\x10\x08\"@\n\x1dEthereumTypedDataValueRequest\x12\x1f\n\x0bmember_path\ TypedDataValueRequest\x12\x1f\n\x0bmember_path\x18\x01\x20\x03(\rR\nmemb\
\x18\x01\x20\x03(\rR\nmemberPath\"1\n\x19EthereumTypedDataValueAck\x12\ erPath\"1\n\x19EthereumTypedDataValueAck\x12\x14\n\x05value\x18\x01\x20\
\x14\n\x05value\x18\x01\x20\x02(\x0cR\x05valueBB\n#com.satoshilabs.trezo\ \x02(\x0cR\x05valueBB\n#com.satoshilabs.trezor.lib.protobufB\x1bTrezorMe\
r.lib.protobufB\x1bTrezorMessageEthereumEIP712\ ssageEthereumEIP712\
"; ";
/// `FileDescriptorProto` object which was a source for this generated file /// `FileDescriptorProto` object which was a source for this generated file
@ -1442,7 +1442,7 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
file_descriptor.get(|| { file_descriptor.get(|| {
let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| {
let mut deps = ::std::vec::Vec::with_capacity(1); let mut deps = ::std::vec::Vec::with_capacity(1);
deps.push(super::messages_ethereum_definitions::file_descriptor().clone()); deps.push(super::messages_ethereum::file_descriptor().clone());
let mut messages = ::std::vec::Vec::with_capacity(7); let mut messages = ::std::vec::Vec::with_capacity(7);
messages.push(EthereumSignTypedData::generated_message_descriptor_data()); messages.push(EthereumSignTypedData::generated_message_descriptor_data());
messages.push(EthereumTypedDataStructRequest::generated_message_descriptor_data()); messages.push(EthereumTypedDataStructRequest::generated_message_descriptor_data());

View File

@ -1046,6 +1046,8 @@ pub struct SolanaTxAdditionalInfo {
// message fields // message fields
// @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxAdditionalInfo.token_accounts_infos) // @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxAdditionalInfo.token_accounts_infos)
pub token_accounts_infos: ::std::vec::Vec<SolanaTxTokenAccountInfo>, pub token_accounts_infos: ::std::vec::Vec<SolanaTxTokenAccountInfo>,
// @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxAdditionalInfo.encoded_token)
pub encoded_token: ::std::option::Option<::std::vec::Vec<u8>>,
// special fields // special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaTxAdditionalInfo.special_fields) // @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaTxAdditionalInfo.special_fields)
pub special_fields: ::protobuf::SpecialFields, pub special_fields: ::protobuf::SpecialFields,
@ -1062,14 +1064,55 @@ impl SolanaTxAdditionalInfo {
::std::default::Default::default() ::std::default::Default::default()
} }
// optional bytes encoded_token = 2;
pub fn encoded_token(&self) -> &[u8] {
match self.encoded_token.as_ref() {
Some(v) => v,
None => &[],
}
}
pub fn clear_encoded_token(&mut self) {
self.encoded_token = ::std::option::Option::None;
}
pub fn has_encoded_token(&self) -> bool {
self.encoded_token.is_some()
}
// Param is passed by value, moved
pub fn set_encoded_token(&mut self, v: ::std::vec::Vec<u8>) {
self.encoded_token = ::std::option::Option::Some(v);
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_encoded_token(&mut self) -> &mut ::std::vec::Vec<u8> {
if self.encoded_token.is_none() {
self.encoded_token = ::std::option::Option::Some(::std::vec::Vec::new());
}
self.encoded_token.as_mut().unwrap()
}
// Take field
pub fn take_encoded_token(&mut self) -> ::std::vec::Vec<u8> {
self.encoded_token.take().unwrap_or_else(|| ::std::vec::Vec::new())
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(1); let mut fields = ::std::vec::Vec::with_capacity(2);
let mut oneofs = ::std::vec::Vec::with_capacity(0); let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>(
"token_accounts_infos", "token_accounts_infos",
|m: &SolanaTxAdditionalInfo| { &m.token_accounts_infos }, |m: &SolanaTxAdditionalInfo| { &m.token_accounts_infos },
|m: &mut SolanaTxAdditionalInfo| { &mut m.token_accounts_infos }, |m: &mut SolanaTxAdditionalInfo| { &mut m.token_accounts_infos },
)); ));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"encoded_token",
|m: &SolanaTxAdditionalInfo| { &m.encoded_token },
|m: &mut SolanaTxAdditionalInfo| { &mut m.encoded_token },
));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SolanaTxAdditionalInfo>( ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SolanaTxAdditionalInfo>(
"SolanaTxAdditionalInfo", "SolanaTxAdditionalInfo",
fields, fields,
@ -1096,6 +1139,9 @@ impl ::protobuf::Message for SolanaTxAdditionalInfo {
10 => { 10 => {
self.token_accounts_infos.push(is.read_message()?); self.token_accounts_infos.push(is.read_message()?);
}, },
18 => {
self.encoded_token = ::std::option::Option::Some(is.read_bytes()?);
},
tag => { tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
}, },
@ -1112,6 +1158,9 @@ impl ::protobuf::Message for SolanaTxAdditionalInfo {
let len = value.compute_size(); let len = value.compute_size();
my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len;
}; };
if let Some(v) = self.encoded_token.as_ref() {
my_size += ::protobuf::rt::bytes_size(2, &v);
}
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32); self.special_fields.cached_size().set(my_size as u32);
my_size my_size
@ -1121,6 +1170,9 @@ impl ::protobuf::Message for SolanaTxAdditionalInfo {
for v in &self.token_accounts_infos { for v in &self.token_accounts_infos {
::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?;
}; };
if let Some(v) = self.encoded_token.as_ref() {
os.write_bytes(2, v)?;
}
os.write_unknown_fields(self.special_fields.unknown_fields())?; os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(()) ::std::result::Result::Ok(())
} }
@ -1139,12 +1191,14 @@ impl ::protobuf::Message for SolanaTxAdditionalInfo {
fn clear(&mut self) { fn clear(&mut self) {
self.token_accounts_infos.clear(); self.token_accounts_infos.clear();
self.encoded_token = ::std::option::Option::None;
self.special_fields.clear(); self.special_fields.clear();
} }
fn default_instance() -> &'static SolanaTxAdditionalInfo { fn default_instance() -> &'static SolanaTxAdditionalInfo {
static instance: SolanaTxAdditionalInfo = SolanaTxAdditionalInfo { static instance: SolanaTxAdditionalInfo = SolanaTxAdditionalInfo {
token_accounts_infos: ::std::vec::Vec::new(), token_accounts_infos: ::std::vec::Vec::new(),
encoded_token: ::std::option::Option::None,
special_fields: ::protobuf::SpecialFields::new(), special_fields: ::protobuf::SpecialFields::new(),
}; };
&instance &instance
@ -1547,14 +1601,15 @@ static file_descriptor_proto_data: &'static [u8] = b"\
TokenAccountInfo\x12!\n\x0cbase_address\x18\x01\x20\x02(\tR\x0bbaseAddre\ TokenAccountInfo\x12!\n\x0cbase_address\x18\x01\x20\x02(\tR\x0bbaseAddre\
ss\x12#\n\rtoken_program\x18\x02\x20\x02(\tR\x0ctokenProgram\x12\x1d\n\n\ ss\x12#\n\rtoken_program\x18\x02\x20\x02(\tR\x0ctokenProgram\x12\x1d\n\n\
token_mint\x18\x03\x20\x02(\tR\ttokenMint\x12#\n\rtoken_account\x18\x04\ token_mint\x18\x03\x20\x02(\tR\ttokenMint\x12#\n\rtoken_account\x18\x04\
\x20\x02(\tR\x0ctokenAccount\"\x7f\n\x16SolanaTxAdditionalInfo\x12e\n\ \x20\x02(\tR\x0ctokenAccount\"\xa4\x01\n\x16SolanaTxAdditionalInfo\x12e\
\x14token_accounts_infos\x18\x01\x20\x03(\x0b23.hw.trezor.messages.solan\ \n\x14token_accounts_infos\x18\x01\x20\x03(\x0b23.hw.trezor.messages.sol\
a.SolanaTxTokenAccountInfoR\x12tokenAccountsInfos\"\xac\x01\n\x0cSolanaS\ ana.SolanaTxTokenAccountInfoR\x12tokenAccountsInfos\x12#\n\rencoded_toke\
ignTx\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12#\n\rseria\ n\x18\x02\x20\x01(\x0cR\x0cencodedToken\"\xac\x01\n\x0cSolanaSignTx\x12\
lized_tx\x18\x02\x20\x02(\x0cR\x0cserializedTx\x12Z\n\x0fadditional_info\ \x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12#\n\rserialized_tx\
\x18\x03\x20\x01(\x0b21.hw.trezor.messages.solana.SolanaTxAdditionalInfo\ \x18\x02\x20\x02(\x0cR\x0cserializedTx\x12Z\n\x0fadditional_info\x18\x03\
R\x0eadditionalInfo\"1\n\x11SolanaTxSignature\x12\x1c\n\tsignature\x18\ \x20\x01(\x0b21.hw.trezor.messages.solana.SolanaTxAdditionalInfoR\x0eadd\
\x01\x20\x02(\x0cR\tsignature\ itionalInfo\"1\n\x11SolanaTxSignature\x12\x1c\n\tsignature\x18\x01\x20\
\x02(\x0cR\tsignature\
"; ";
/// `FileDescriptorProto` object which was a source for this generated file /// `FileDescriptorProto` object which was a source for this generated file

View File

@ -21,6 +21,7 @@ mod generated {
messages_common messages_common
messages_crypto messages_crypto
messages_debug messages_debug
messages_definitions
messages_management messages_management
messages_benchmark messages_benchmark
options options
@ -28,7 +29,6 @@ mod generated {
"bitcoin" => messages_bitcoin "bitcoin" => messages_bitcoin
"ethereum" => messages_ethereum "ethereum" => messages_ethereum
"ethereum" => messages_ethereum_eip712 "ethereum" => messages_ethereum_eip712
"ethereum" => messages_ethereum_definitions
"binance" => messages_binance "binance" => messages_binance
"cardano" => messages_cardano "cardano" => messages_cardano
"eos" => messages_eos "eos" => messages_eos