mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-03 15:39:03 +00:00
feat(core): add loadable solana tokens
This commit is contained in:
parent
1d444c3845
commit
ffbdea202a
@ -1623,7 +1623,8 @@
|
||||
{
|
||||
"name": "mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "account_to_mint",
|
||||
@ -1676,7 +1677,8 @@
|
||||
{
|
||||
"name": "token_mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "owner",
|
||||
@ -1754,7 +1756,8 @@
|
||||
{
|
||||
"name": "token_mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "freeze_authority",
|
||||
@ -1791,7 +1794,8 @@
|
||||
{
|
||||
"name": "token_mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "freeze_authority",
|
||||
@ -1839,7 +1843,8 @@
|
||||
{
|
||||
"name": "token_mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "destination_account",
|
||||
@ -1900,7 +1905,8 @@
|
||||
{
|
||||
"name": "token_mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "delegate",
|
||||
@ -1956,7 +1962,8 @@
|
||||
{
|
||||
"name": "mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "account_to_mint",
|
||||
@ -2013,7 +2020,8 @@
|
||||
{
|
||||
"name": "token_mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "owner",
|
||||
@ -2430,7 +2438,8 @@
|
||||
{
|
||||
"name": "mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "account_to_mint",
|
||||
@ -2483,7 +2492,8 @@
|
||||
{
|
||||
"name": "token_mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "owner",
|
||||
@ -2561,7 +2571,8 @@
|
||||
{
|
||||
"name": "token_mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "freeze_authority",
|
||||
@ -2598,7 +2609,8 @@
|
||||
{
|
||||
"name": "token_mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "freeze_authority",
|
||||
@ -2646,7 +2658,8 @@
|
||||
{
|
||||
"name": "token_mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "destination_account",
|
||||
@ -2707,7 +2720,8 @@
|
||||
{
|
||||
"name": "token_mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "delegate",
|
||||
@ -2763,7 +2777,8 @@
|
||||
{
|
||||
"name": "mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "account_to_mint",
|
||||
@ -2820,7 +2835,8 @@
|
||||
{
|
||||
"name": "token_mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "owner",
|
||||
@ -2997,7 +3013,8 @@
|
||||
{
|
||||
"name": "token_mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "system_program",
|
||||
@ -3059,7 +3076,8 @@
|
||||
{
|
||||
"name": "token_mint",
|
||||
"is_authority": false,
|
||||
"optional": false
|
||||
"optional": false,
|
||||
"is_token_mint": true
|
||||
},
|
||||
{
|
||||
"name": "system_program",
|
||||
|
@ -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
|
||||
protoc -I/usr/include -I. $< -o $@
|
||||
|
61
common/protob/messages-definitions.proto
Normal file
61
common/protob/messages-definitions.proto
Normal 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;
|
||||
}
|
@ -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
|
||||
}
|
@ -5,7 +5,7 @@ package hw.trezor.messages.ethereum_eip712;
|
||||
option java_package = "com.satoshilabs.trezor.lib.protobuf";
|
||||
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
|
||||
@ -22,10 +22,10 @@ import "messages-ethereum-definitions.proto";
|
||||
* @next Failure
|
||||
*/
|
||||
message EthereumSignTypedData {
|
||||
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
|
||||
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
|
||||
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
|
||||
optional bool metamask_v4_compat = 3 [default=true]; // use MetaMask v4 (see https://github.com/MetaMask/eth-sig-util/issues/106)
|
||||
optional ethereum.EthereumDefinitions definitions = 4; // network and/or token definitions
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,6 @@ option java_package = "com.satoshilabs.trezor.lib.protobuf";
|
||||
option java_outer_classname = "TrezorMessageEthereum";
|
||||
|
||||
import "messages-common.proto";
|
||||
import "messages-ethereum-definitions.proto";
|
||||
|
||||
/**
|
||||
* Request: Ask device for public key corresponding to address_n path
|
||||
@ -60,18 +59,18 @@ message EthereumAddress {
|
||||
* @next Failure
|
||||
*/
|
||||
message EthereumSignTx {
|
||||
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
|
||||
required bytes gas_price = 3; // <=256 bit unsigned big endian (in wei)
|
||||
required bytes gas_limit = 4; // <=256 bit unsigned big endian
|
||||
optional string to = 11 [default='']; // recipient address
|
||||
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 uint32 data_length = 8 [default=0]; // Length of transaction payload
|
||||
required uint64 chain_id = 9; // Chain Id for EIP 155
|
||||
optional uint32 tx_type = 10; // Used for Wanchain
|
||||
optional ethereum_definitions.EthereumDefinitions definitions = 12; // network and/or token definitions for tx
|
||||
optional bool chunkify = 13; // display the address in chunks of 4 characters
|
||||
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
|
||||
required bytes gas_price = 3; // <=256 bit unsigned big endian (in wei)
|
||||
required bytes gas_limit = 4; // <=256 bit unsigned big endian
|
||||
optional string to = 11 [default='']; // recipient address
|
||||
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 uint32 data_length = 8 [default=0]; // Length of transaction payload
|
||||
required uint64 chain_id = 9; // Chain Id for EIP 155
|
||||
optional uint32 tx_type = 10; // Used for Wanchain
|
||||
optional EthereumDefinitions definitions = 12; // network and/or token definitions for tx
|
||||
optional bool chunkify = 13; // display the address in chunks of 4 characters
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,19 +81,19 @@ message EthereumSignTx {
|
||||
* @next Failure
|
||||
*/
|
||||
message EthereumSignTxEIP1559 {
|
||||
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 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 gas_limit = 5; // <=256 bit unsigned big endian
|
||||
optional string to = 6 [default='']; // recipient address
|
||||
required bytes value = 7; // <=256 bit unsigned big endian (in wei)
|
||||
optional bytes data_initial_chunk = 8 [default='']; // The initial data chunk (<= 1024 bytes)
|
||||
required uint32 data_length = 9; // Length of transaction payload
|
||||
required uint64 chain_id = 10; // Chain Id for EIP 155
|
||||
repeated EthereumAccessList access_list = 11; // Access List
|
||||
optional ethereum_definitions.EthereumDefinitions definitions = 12; // network and/or token definitions for tx
|
||||
optional bool chunkify = 13; // display the address in chunks of 4 characters
|
||||
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 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 gas_limit = 5; // <=256 bit unsigned big endian
|
||||
optional string to = 6 [default='']; // recipient address
|
||||
required bytes value = 7; // <=256 bit unsigned big endian (in wei)
|
||||
optional bytes data_initial_chunk = 8 [default='']; // The initial data chunk (<= 1024 bytes)
|
||||
required uint32 data_length = 9; // Length of transaction payload
|
||||
required uint64 chain_id = 10; // Chain Id for EIP 155
|
||||
repeated EthereumAccessList access_list = 11; // Access List
|
||||
optional EthereumDefinitions definitions = 12; // network and/or token definitions for tx
|
||||
optional bool chunkify = 13; // display the address in chunks of 4 characters
|
||||
|
||||
message EthereumAccessList {
|
||||
required string address = 1;
|
||||
@ -180,3 +179,12 @@ message EthereumTypedDataSignature {
|
||||
required bytes signature = 1; // signature of 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
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ message SolanaTxTokenAccountInfo {
|
||||
*/
|
||||
message SolanaTxAdditionalInfo {
|
||||
repeated SolanaTxTokenAccountInfo token_accounts_infos = 1;
|
||||
optional bytes encoded_token = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -171,7 +171,7 @@ def render_file(
|
||||
result = template.render(
|
||||
support_info=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,
|
||||
ROOT=ROOT,
|
||||
ALTCOIN_PREFIXES=ALTCOIN_PREFIXES,
|
||||
|
@ -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.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/*.py',
|
||||
exclude=[
|
||||
SOURCE_PY_DIR + 'trezor/enums/Binance*.py',
|
||||
SOURCE_PY_DIR + 'trezor/enums/Cardano*.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/Ethereum*.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/common/*.py',
|
||||
exclude=[
|
||||
SOURCE_PY_DIR + 'apps/common/sdcard.py',
|
||||
] if not SDCARD else []
|
||||
SOURCE_PY_DIR + 'apps/common/definitions.py',
|
||||
SOURCE_PY_DIR + 'apps/common/definitions_constants.py',
|
||||
] + (
|
||||
[SOURCE_PY_DIR + 'apps/common/sdcard.py'] if not SDCARD else []
|
||||
)
|
||||
))
|
||||
if PYOPT == '0':
|
||||
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'))
|
||||
|
||||
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 + 'trezor/enums/Binance*.py'))
|
||||
|
||||
|
@ -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.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/*.py',
|
||||
exclude=[
|
||||
SOURCE_PY_DIR + 'trezor/enums/Binance*.py',
|
||||
SOURCE_PY_DIR + 'trezor/enums/Cardano*.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/Ethereum*.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/common/*.py',
|
||||
exclude=[
|
||||
SOURCE_PY_DIR + 'apps/common/sdcard.py',
|
||||
] if "sd_card" not in FEATURES_AVAILABLE else []
|
||||
SOURCE_PY_DIR + 'apps/common/definitions.py',
|
||||
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':
|
||||
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'))
|
||||
|
||||
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 + 'trezor/enums/Binance*.py'))
|
||||
|
||||
|
91
core/src/apps/common/definitions.py
Normal file
91
core/src/apps/common/definitions.py
Normal 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")
|
@ -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",
|
||||
)
|
||||
|
||||
MIN_DATA_VERSION = ${ethereum_defs_timestamp}
|
||||
MIN_DATA_VERSION = ${defs_timestamp}
|
||||
FORMAT_VERSION = b"trzd1"
|
||||
|
||||
if __debug__:
|
@ -4,88 +4,8 @@ from trezor.messages import EthereumNetworkInfo, EthereumTokenInfo
|
||||
from trezor.wire import DataError
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import TypeVar
|
||||
|
||||
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 that holds Ethereum definitions - network and tokens.
|
||||
@ -106,6 +26,8 @@ class Definitions:
|
||||
chain_id: int | None = None,
|
||||
slip44: int | None = None,
|
||||
) -> Self:
|
||||
from apps.common.definitions import decode_definition
|
||||
|
||||
from .networks import UNKNOWN_NETWORK, by_chain_id, by_slip44
|
||||
|
||||
network = UNKNOWN_NETWORK
|
||||
|
29
core/src/apps/solana/definitions.py
Normal file
29
core/src/apps/solana/definitions.py
Normal 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)
|
@ -21,6 +21,7 @@ from .types import AddressType
|
||||
if TYPE_CHECKING:
|
||||
from typing import Sequence
|
||||
|
||||
from .definitions import Definitions
|
||||
from .transaction import Fee
|
||||
from .transaction.instructions import Instruction, SystemProgramTransferInstruction
|
||||
from .types import AddressReference
|
||||
@ -55,6 +56,7 @@ async def confirm_instruction(
|
||||
instruction_index: int,
|
||||
signer_path: list[int],
|
||||
signer_public_key: bytes,
|
||||
definitions: Definitions,
|
||||
) -> None:
|
||||
instruction_title = (
|
||||
f"{instruction_index}/{instructions_count}: {instruction.ui_name}"
|
||||
@ -114,17 +116,17 @@ async def confirm_instruction(
|
||||
continue
|
||||
|
||||
account_data: list[tuple[str, str]] = []
|
||||
# account included in the transaction directly
|
||||
if len(account_value) == 2:
|
||||
signer_suffix = ""
|
||||
if account_value[0] == signer_public_key:
|
||||
signer_suffix = f" ({TR.words__signer})"
|
||||
account_description = f"{base58.encode(account_value[0])}"
|
||||
if account_template.is_token_mint:
|
||||
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(
|
||||
(
|
||||
ui_property.display_name,
|
||||
f"{base58.encode(account_value[0])}{signer_suffix}",
|
||||
)
|
||||
)
|
||||
account_data.append((ui_property.display_name, account_description))
|
||||
# lookup table address reference
|
||||
elif len(account_value) == 3:
|
||||
account_data += _get_address_reference_props(
|
||||
account_value, ui_property.display_name
|
||||
@ -295,6 +297,7 @@ async def confirm_token_transfer(
|
||||
destination_account: bytes,
|
||||
token_account: bytes,
|
||||
token_mint: bytes,
|
||||
token_symbol: str,
|
||||
amount: int,
|
||||
decimals: int,
|
||||
fee: Fee,
|
||||
@ -327,7 +330,7 @@ async def confirm_token_transfer(
|
||||
await confirm_custom_transaction(
|
||||
amount,
|
||||
decimals,
|
||||
"[TOKEN]",
|
||||
token_symbol,
|
||||
fee,
|
||||
signer_path,
|
||||
blockhash,
|
||||
|
@ -14,9 +14,8 @@ from .transaction.instructions import (
|
||||
if TYPE_CHECKING:
|
||||
from typing import Type
|
||||
|
||||
from trezor.messages import SolanaTxAdditionalInfo
|
||||
|
||||
from .transaction import Fee
|
||||
from .types import AdditionalTxInfo
|
||||
|
||||
TransferTokenInstruction = (
|
||||
TokenProgramTransferCheckedInstruction
|
||||
@ -122,7 +121,7 @@ async def try_confirm_token_transfer_transaction(
|
||||
fee: Fee,
|
||||
signer_path: list[int],
|
||||
blockhash: bytes,
|
||||
additional_info: SolanaTxAdditionalInfo | None = None,
|
||||
additional_info: AdditionalTxInfo,
|
||||
) -> bool:
|
||||
from .layout import confirm_token_transfer
|
||||
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_account = transfer_token_instructions[0].destination_account[0]
|
||||
|
||||
base_address = (
|
||||
try_get_token_account_base_address(
|
||||
token_account,
|
||||
token_program,
|
||||
token_mint,
|
||||
additional_info.token_accounts_infos,
|
||||
)
|
||||
if additional_info is not None
|
||||
else None
|
||||
base_address = try_get_token_account_base_address(
|
||||
token_account,
|
||||
token_program,
|
||||
token_mint,
|
||||
additional_info.token_accounts_infos,
|
||||
)
|
||||
|
||||
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(
|
||||
token_account if base_address is None else base_address,
|
||||
token_account,
|
||||
token_mint,
|
||||
token_symbol,
|
||||
total_token_amount,
|
||||
transfer_token_instructions[0].decimals,
|
||||
fee,
|
||||
@ -178,7 +179,7 @@ async def try_confirm_predefined_transaction(
|
||||
signer_path: list[int],
|
||||
signer_public_key: bytes,
|
||||
blockhash: bytes,
|
||||
additional_info: SolanaTxAdditionalInfo | None = None,
|
||||
additional_info: AdditionalTxInfo,
|
||||
) -> bool:
|
||||
from .layout import confirm_system_transfer
|
||||
from .transaction.instructions import SystemProgramTransferInstruction
|
||||
|
@ -6,6 +6,7 @@ from apps.common.keychain import with_slip44_keychain
|
||||
|
||||
from . import CURVE, PATTERNS, SLIP44_ID
|
||||
from .transaction import Transaction
|
||||
from .types import AdditionalTxInfo
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from trezor.messages import SolanaSignTx, SolanaTxSignature
|
||||
@ -58,15 +59,21 @@ async def sign_tx(
|
||||
|
||||
fee = transaction.calculate_fee()
|
||||
|
||||
additional_tx_info = AdditionalTxInfo.from_solana_tx_additional_info(
|
||||
msg.additional_info
|
||||
)
|
||||
|
||||
if not await try_confirm_predefined_transaction(
|
||||
transaction,
|
||||
fee,
|
||||
address_n,
|
||||
signer_public_key,
|
||||
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(
|
||||
address_n,
|
||||
transaction.blockhash,
|
||||
@ -79,9 +86,11 @@ async def sign_tx(
|
||||
|
||||
|
||||
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:
|
||||
|
||||
visible_instructions = transaction.get_visible_instructions()
|
||||
instructions_count = len(visible_instructions)
|
||||
for instruction_index, instruction in enumerate(visible_instructions, 1):
|
||||
@ -114,4 +123,5 @@ async def confirm_instructions(
|
||||
instruction_index,
|
||||
signer_path,
|
||||
signer_public_key,
|
||||
additional_info.definitions,
|
||||
)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -181,6 +181,7 @@ def get_instruction(
|
||||
"${reference["name"]}",
|
||||
${reference["is_authority"]},
|
||||
${reference["optional"]},
|
||||
${reference.get("is_token_mint", False)},
|
||||
),
|
||||
% endfor
|
||||
],
|
||||
|
@ -1,10 +1,14 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from .definitions import Definitions
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from enum import IntEnum
|
||||
from typing import Any, Callable, Generic, TypeVar
|
||||
|
||||
from trezor.messages import SolanaTxAdditionalInfo, SolanaTxTokenAccountInfo
|
||||
from trezor.utils import BufferReader
|
||||
from typing_extensions import Self
|
||||
|
||||
from .transaction import Instruction
|
||||
|
||||
@ -51,10 +55,13 @@ class PropertyTemplate(Generic[T]):
|
||||
|
||||
|
||||
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.is_authority = is_authority
|
||||
self.optional = optional
|
||||
self.is_token_mint = is_token_mint
|
||||
|
||||
|
||||
class UIProperty:
|
||||
@ -71,3 +78,26 @@ class UIProperty:
|
||||
self.display_name = display_name
|
||||
self.is_authority = is_authority
|
||||
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),
|
||||
)
|
||||
|
@ -2,5 +2,6 @@
|
||||
# fmt: off
|
||||
# isort:skip_file
|
||||
|
||||
NETWORK = 0
|
||||
TOKEN = 1
|
||||
ETHEREUM_NETWORK = 0
|
||||
ETHEREUM_TOKEN = 1
|
||||
SOLANA_TOKEN = 2
|
7
core/src/trezor/enums/__init__.py
generated
7
core/src/trezor/enums/__init__.py
generated
@ -285,9 +285,10 @@ if TYPE_CHECKING:
|
||||
NEXT_LAYOUT = 1
|
||||
CURRENT_LAYOUT = 2
|
||||
|
||||
class EthereumDefinitionType(IntEnum):
|
||||
NETWORK = 0
|
||||
TOKEN = 1
|
||||
class DefinitionType(IntEnum):
|
||||
ETHEREUM_NETWORK = 0
|
||||
ETHEREUM_TOKEN = 1
|
||||
SOLANA_TOKEN = 2
|
||||
|
||||
class EthereumDataType(IntEnum):
|
||||
UINT = 1
|
||||
|
362
core/src/trezor/messages.py
generated
362
core/src/trezor/messages.py
generated
@ -42,9 +42,9 @@ if TYPE_CHECKING:
|
||||
from trezor.enums import DebugSwipeDirection # noqa: F401
|
||||
from trezor.enums import DebugWaitType # 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 EthereumDataType # noqa: F401
|
||||
from trezor.enums import EthereumDefinitionType # noqa: F401
|
||||
from trezor.enums import FailureType # noqa: F401
|
||||
from trezor.enums import HomescreenFormat # 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"]:
|
||||
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):
|
||||
address_n: "list[int]"
|
||||
show_display: "bool | None"
|
||||
@ -3598,176 +3658,6 @@ if TYPE_CHECKING:
|
||||
def is_type_of(cls, msg: Any) -> TypeGuard["EosActionUnknown"]:
|
||||
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):
|
||||
address_n: "list[int]"
|
||||
show_display: "bool | None"
|
||||
@ -4034,6 +3924,22 @@ if TYPE_CHECKING:
|
||||
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumTypedDataSignature"]:
|
||||
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):
|
||||
address: "str"
|
||||
storage_keys: "list[bytes]"
|
||||
@ -4050,6 +3956,118 @@ if TYPE_CHECKING:
|
||||
def is_type_of(cls, msg: Any) -> TypeGuard["EthereumAccessList"]:
|
||||
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):
|
||||
outputs: "list[MoneroOutputEntry]"
|
||||
real_output: "int | None"
|
||||
@ -5492,11 +5510,13 @@ if TYPE_CHECKING:
|
||||
|
||||
class SolanaTxAdditionalInfo(protobuf.MessageType):
|
||||
token_accounts_infos: "list[SolanaTxTokenAccountInfo]"
|
||||
encoded_token: "bytes | None"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
token_accounts_infos: "list[SolanaTxTokenAccountInfo] | None" = None,
|
||||
encoded_token: "bytes | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
|
@ -4,7 +4,7 @@ from trezor import messages, protobuf
|
||||
from trezor.crypto import cosi
|
||||
from trezor.crypto.curve import ed25519
|
||||
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")]
|
||||
|
||||
@ -41,7 +41,7 @@ def make_token(
|
||||
|
||||
def make_payload(
|
||||
prefix: bytes = b"trzd1",
|
||||
data_type: EthereumDefinitionType = EthereumDefinitionType.NETWORK,
|
||||
data_type: DefinitionType = DefinitionType.ETHEREUM_NETWORK,
|
||||
timestamp: int = 0xFFFF_FFFF,
|
||||
message: (
|
||||
messages.EthereumNetworkInfo | messages.EthereumTokenInfo | bytes
|
||||
@ -106,7 +106,7 @@ def encode_network(
|
||||
) -> bytes:
|
||||
if network is None:
|
||||
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, [])
|
||||
return payload + proof + signature
|
||||
|
||||
@ -121,6 +121,6 @@ def encode_token(
|
||||
) -> bytes:
|
||||
if token is None:
|
||||
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, [])
|
||||
return payload + proof + signature
|
||||
|
@ -9,11 +9,12 @@ from trezor import utils, wire
|
||||
if not utils.BITCOIN_ONLY:
|
||||
|
||||
from ethereum_common import *
|
||||
from trezor.enums import EthereumDefinitionType
|
||||
from trezor.enums import DefinitionType
|
||||
from trezor.messages import EthereumNetworkInfo, EthereumTokenInfo
|
||||
|
||||
from apps.common.definitions import decode_definition
|
||||
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"
|
||||
|
||||
@ -92,7 +93,7 @@ class TestDecodeDefinition(unittest.TestCase):
|
||||
|
||||
def test_bad_type(self):
|
||||
payload = make_payload(
|
||||
data_type=EthereumDefinitionType.TOKEN, message=make_token()
|
||||
data_type=DefinitionType.ETHEREUM_TOKEN, message=make_token()
|
||||
)
|
||||
proof, signature = sign_payload(payload, [])
|
||||
self.assertFailed(payload + proof + signature)
|
||||
@ -109,13 +110,13 @@ class TestDecodeDefinition(unittest.TestCase):
|
||||
|
||||
def test_protobuf_mismatch(self):
|
||||
payload = make_payload(
|
||||
data_type=EthereumDefinitionType.NETWORK, message=make_token()
|
||||
data_type=DefinitionType.ETHEREUM_NETWORK, message=make_token()
|
||||
)
|
||||
proof, signature = sign_payload(payload, [])
|
||||
self.assertFailed(payload + proof + signature)
|
||||
|
||||
payload = make_payload(
|
||||
data_type=EthereumDefinitionType.TOKEN, message=make_network()
|
||||
data_type=DefinitionType.ETHEREUM_TOKEN, message=make_network()
|
||||
)
|
||||
proof, signature = sign_payload(payload, [])
|
||||
self.assertFailed(payload + proof + signature)
|
||||
|
@ -89,7 +89,7 @@ Each definition is encoded as a protobuf message `EthereumNetworkInfo` or
|
||||
All numbers are unsigned little endian.
|
||||
|
||||
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)
|
||||
4. protobuf payload length (2 bytes)
|
||||
5. protobuf payload (N bytes)
|
||||
|
22
docs/common/solana-definitions.md
Normal file
22
docs/common/solana-definitions.md
Normal 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.
|
@ -8,7 +8,7 @@ import requests
|
||||
from construct_classes import Struct, subcon
|
||||
|
||||
from . import cosi, merkle_tree
|
||||
from .messages import EthereumDefinitionType
|
||||
from .messages import DefinitionType
|
||||
from .tools import EnumAdapter
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -38,13 +38,13 @@ ProofFormat = c.PrefixedArray(c.Int8ul, c.Bytes(32))
|
||||
|
||||
class DefinitionPayload(Struct):
|
||||
magic: bytes
|
||||
data_type: EthereumDefinitionType
|
||||
data_type: DefinitionType
|
||||
timestamp: int
|
||||
data: bytes
|
||||
|
||||
SUBCON = c.Struct(
|
||||
"magic" / c.Const(FORMAT_MAGIC),
|
||||
"data_type" / EnumAdapter(c.Int8ul, EthereumDefinitionType),
|
||||
"data_type" / EnumAdapter(c.Int8ul, DefinitionType),
|
||||
"timestamp" / c.Int32ul,
|
||||
"data" / c.Prefixed(c.Int16ul, c.GreedyBytes),
|
||||
)
|
||||
|
400
python/src/trezorlib/messages.py
generated
400
python/src/trezorlib/messages.py
generated
@ -326,9 +326,10 @@ class DebugWaitType(IntEnum):
|
||||
CURRENT_LAYOUT = 2
|
||||
|
||||
|
||||
class EthereumDefinitionType(IntEnum):
|
||||
NETWORK = 0
|
||||
TOKEN = 1
|
||||
class DefinitionType(IntEnum):
|
||||
ETHEREUM_NETWORK = 0
|
||||
ETHEREUM_TOKEN = 1
|
||||
SOLANA_TOKEN = 2
|
||||
|
||||
|
||||
class EthereumDataType(IntEnum):
|
||||
@ -4347,6 +4348,75 @@ class DebugLinkOptigaSetSecMax(protobuf.MessageType):
|
||||
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):
|
||||
MESSAGE_WIRE_TYPE = 600
|
||||
FIELDS = {
|
||||
@ -4943,191 +5013,6 @@ class EosActionUnknown(protobuf.MessageType):
|
||||
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):
|
||||
MESSAGE_WIRE_TYPE = 450
|
||||
FIELDS = {
|
||||
@ -5439,6 +5324,23 @@ class EthereumTypedDataSignature(protobuf.MessageType):
|
||||
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):
|
||||
MESSAGE_WIRE_TYPE = None
|
||||
FIELDS = {
|
||||
@ -5456,6 +5358,125 @@ class EthereumAccessList(protobuf.MessageType):
|
||||
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):
|
||||
MESSAGE_WIRE_TYPE = None
|
||||
FIELDS = {
|
||||
@ -7083,14 +7104,17 @@ class SolanaTxAdditionalInfo(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = None
|
||||
FIELDS = {
|
||||
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__(
|
||||
self,
|
||||
*,
|
||||
token_accounts_infos: Optional[Sequence["SolanaTxTokenAccountInfo"]] = None,
|
||||
encoded_token: Optional["bytes"] = None,
|
||||
) -> None:
|
||||
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):
|
||||
|
@ -19,26 +19,26 @@
|
||||
#![allow(unused_results)]
|
||||
#![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
|
||||
/// of protobuf runtime.
|
||||
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)]
|
||||
pub struct EthereumNetworkInfo {
|
||||
// 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>,
|
||||
// @@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>,
|
||||
// @@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>,
|
||||
// @@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>,
|
||||
// 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,
|
||||
}
|
||||
|
||||
@ -323,22 +323,22 @@ impl ::protobuf::reflect::ProtobufValue for EthereumNetworkInfo {
|
||||
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)]
|
||||
pub struct EthereumTokenInfo {
|
||||
// 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>>,
|
||||
// @@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>,
|
||||
// @@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>,
|
||||
// @@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>,
|
||||
// @@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>,
|
||||
// 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,
|
||||
}
|
||||
|
||||
@ -678,127 +678,179 @@ impl ::protobuf::reflect::ProtobufValue for EthereumTokenInfo {
|
||||
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)]
|
||||
pub struct EthereumDefinitions {
|
||||
pub struct SolanaTokenInfo {
|
||||
// message fields
|
||||
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumDefinitions.encoded_network)
|
||||
pub encoded_network: ::std::option::Option<::std::vec::Vec<u8>>,
|
||||
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_definitions.EthereumDefinitions.encoded_token)
|
||||
pub encoded_token: ::std::option::Option<::std::vec::Vec<u8>>,
|
||||
// @@protoc_insertion_point(field:hw.trezor.messages.definitions.SolanaTokenInfo.mint)
|
||||
pub mint: ::std::option::Option<::std::vec::Vec<u8>>,
|
||||
// @@protoc_insertion_point(field:hw.trezor.messages.definitions.SolanaTokenInfo.symbol)
|
||||
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
|
||||
// @@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,
|
||||
}
|
||||
|
||||
impl<'a> ::std::default::Default for &'a EthereumDefinitions {
|
||||
fn default() -> &'a EthereumDefinitions {
|
||||
<EthereumDefinitions as ::protobuf::Message>::default_instance()
|
||||
impl<'a> ::std::default::Default for &'a SolanaTokenInfo {
|
||||
fn default() -> &'a SolanaTokenInfo {
|
||||
<SolanaTokenInfo as ::protobuf::Message>::default_instance()
|
||||
}
|
||||
}
|
||||
|
||||
impl EthereumDefinitions {
|
||||
pub fn new() -> EthereumDefinitions {
|
||||
impl SolanaTokenInfo {
|
||||
pub fn new() -> SolanaTokenInfo {
|
||||
::std::default::Default::default()
|
||||
}
|
||||
|
||||
// optional bytes encoded_network = 1;
|
||||
// required bytes mint = 1;
|
||||
|
||||
pub fn encoded_network(&self) -> &[u8] {
|
||||
match self.encoded_network.as_ref() {
|
||||
pub fn mint(&self) -> &[u8] {
|
||||
match self.mint.as_ref() {
|
||||
Some(v) => v,
|
||||
None => &[],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clear_encoded_network(&mut self) {
|
||||
self.encoded_network = ::std::option::Option::None;
|
||||
pub fn clear_mint(&mut self) {
|
||||
self.mint = ::std::option::Option::None;
|
||||
}
|
||||
|
||||
pub fn has_encoded_network(&self) -> bool {
|
||||
self.encoded_network.is_some()
|
||||
pub fn has_mint(&self) -> bool {
|
||||
self.mint.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);
|
||||
pub fn set_mint(&mut self, v: ::std::vec::Vec<u8>) {
|
||||
self.mint = ::std::option::Option::Some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_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());
|
||||
pub fn mut_mint(&mut self) -> &mut ::std::vec::Vec<u8> {
|
||||
if self.mint.is_none() {
|
||||
self.mint = ::std::option::Option::Some(::std::vec::Vec::new());
|
||||
}
|
||||
self.encoded_network.as_mut().unwrap()
|
||||
self.mint.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())
|
||||
pub fn take_mint(&mut self) -> ::std::vec::Vec<u8> {
|
||||
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] {
|
||||
match self.encoded_token.as_ref() {
|
||||
pub fn symbol(&self) -> &str {
|
||||
match self.symbol.as_ref() {
|
||||
Some(v) => v,
|
||||
None => &[],
|
||||
None => "",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clear_encoded_token(&mut self) {
|
||||
self.encoded_token = ::std::option::Option::None;
|
||||
pub fn clear_symbol(&mut self) {
|
||||
self.symbol = ::std::option::Option::None;
|
||||
}
|
||||
|
||||
pub fn has_encoded_token(&self) -> bool {
|
||||
self.encoded_token.is_some()
|
||||
pub fn has_symbol(&self) -> bool {
|
||||
self.symbol.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);
|
||||
pub fn set_symbol(&mut self, v: ::std::string::String) {
|
||||
self.symbol = ::std::option::Option::Some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_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());
|
||||
pub fn mut_symbol(&mut self) -> &mut ::std::string::String {
|
||||
if self.symbol.is_none() {
|
||||
self.symbol = ::std::option::Option::Some(::std::string::String::new());
|
||||
}
|
||||
self.encoded_token.as_mut().unwrap()
|
||||
self.symbol.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())
|
||||
pub fn take_symbol(&mut self) -> ::std::string::String {
|
||||
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 {
|
||||
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);
|
||||
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
|
||||
"encoded_network",
|
||||
|m: &EthereumDefinitions| { &m.encoded_network },
|
||||
|m: &mut EthereumDefinitions| { &mut m.encoded_network },
|
||||
"mint",
|
||||
|m: &SolanaTokenInfo| { &m.mint },
|
||||
|m: &mut SolanaTokenInfo| { &mut m.mint },
|
||||
));
|
||||
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
|
||||
"encoded_token",
|
||||
|m: &EthereumDefinitions| { &m.encoded_token },
|
||||
|m: &mut EthereumDefinitions| { &mut m.encoded_token },
|
||||
"symbol",
|
||||
|m: &SolanaTokenInfo| { &m.symbol },
|
||||
|m: &mut SolanaTokenInfo| { &mut m.symbol },
|
||||
));
|
||||
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<EthereumDefinitions>(
|
||||
"EthereumDefinitions",
|
||||
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
|
||||
"name",
|
||||
|m: &SolanaTokenInfo| { &m.name },
|
||||
|m: &mut SolanaTokenInfo| { &mut m.name },
|
||||
));
|
||||
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SolanaTokenInfo>(
|
||||
"SolanaTokenInfo",
|
||||
fields,
|
||||
oneofs,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::Message for EthereumDefinitions {
|
||||
const NAME: &'static str = "EthereumDefinitions";
|
||||
impl ::protobuf::Message for SolanaTokenInfo {
|
||||
const NAME: &'static str = "SolanaTokenInfo";
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@ -806,10 +858,13 @@ impl ::protobuf::Message for EthereumDefinitions {
|
||||
while let Some(tag) = is.read_raw_tag_or_eof()? {
|
||||
match tag {
|
||||
10 => {
|
||||
self.encoded_network = ::std::option::Option::Some(is.read_bytes()?);
|
||||
self.mint = ::std::option::Option::Some(is.read_bytes()?);
|
||||
},
|
||||
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 => {
|
||||
::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)]
|
||||
fn compute_size(&self) -> u64 {
|
||||
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);
|
||||
}
|
||||
if let Some(v) = self.encoded_token.as_ref() {
|
||||
my_size += ::protobuf::rt::bytes_size(2, &v);
|
||||
if let Some(v) = self.symbol.as_ref() {
|
||||
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());
|
||||
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<()> {
|
||||
if let Some(v) = self.encoded_network.as_ref() {
|
||||
if let Some(v) = self.mint.as_ref() {
|
||||
os.write_bytes(1, v)?;
|
||||
}
|
||||
if let Some(v) = self.encoded_token.as_ref() {
|
||||
os.write_bytes(2, v)?;
|
||||
if let Some(v) = self.symbol.as_ref() {
|
||||
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())?;
|
||||
::std::result::Result::Ok(())
|
||||
@ -853,85 +914,92 @@ impl ::protobuf::Message for EthereumDefinitions {
|
||||
&mut self.special_fields
|
||||
}
|
||||
|
||||
fn new() -> EthereumDefinitions {
|
||||
EthereumDefinitions::new()
|
||||
fn new() -> SolanaTokenInfo {
|
||||
SolanaTokenInfo::new()
|
||||
}
|
||||
|
||||
fn clear(&mut self) {
|
||||
self.encoded_network = ::std::option::Option::None;
|
||||
self.encoded_token = ::std::option::Option::None;
|
||||
self.mint = ::std::option::Option::None;
|
||||
self.symbol = ::std::option::Option::None;
|
||||
self.name = ::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,
|
||||
fn default_instance() -> &'static SolanaTokenInfo {
|
||||
static instance: SolanaTokenInfo = SolanaTokenInfo {
|
||||
mint: ::std::option::Option::None,
|
||||
symbol: ::std::option::Option::None,
|
||||
name: ::std::option::Option::None,
|
||||
special_fields: ::protobuf::SpecialFields::new(),
|
||||
};
|
||||
&instance
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::MessageFull for EthereumDefinitions {
|
||||
impl ::protobuf::MessageFull for SolanaTokenInfo {
|
||||
fn descriptor() -> ::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()
|
||||
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 {
|
||||
::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>;
|
||||
}
|
||||
|
||||
#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)]
|
||||
// @@protoc_insertion_point(enum:hw.trezor.messages.ethereum_definitions.EthereumDefinitionType)
|
||||
pub enum EthereumDefinitionType {
|
||||
// @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_definitions.EthereumDefinitionType.NETWORK)
|
||||
NETWORK = 0,
|
||||
// @@protoc_insertion_point(enum_value:hw.trezor.messages.ethereum_definitions.EthereumDefinitionType.TOKEN)
|
||||
TOKEN = 1,
|
||||
// @@protoc_insertion_point(enum:hw.trezor.messages.definitions.DefinitionType)
|
||||
pub enum DefinitionType {
|
||||
// @@protoc_insertion_point(enum_value:hw.trezor.messages.definitions.DefinitionType.ETHEREUM_NETWORK)
|
||||
ETHEREUM_NETWORK = 0,
|
||||
// @@protoc_insertion_point(enum_value:hw.trezor.messages.definitions.DefinitionType.ETHEREUM_TOKEN)
|
||||
ETHEREUM_TOKEN = 1,
|
||||
// @@protoc_insertion_point(enum_value:hw.trezor.messages.definitions.DefinitionType.SOLANA_TOKEN)
|
||||
SOLANA_TOKEN = 2,
|
||||
}
|
||||
|
||||
impl ::protobuf::Enum for EthereumDefinitionType {
|
||||
const NAME: &'static str = "EthereumDefinitionType";
|
||||
impl ::protobuf::Enum for DefinitionType {
|
||||
const NAME: &'static str = "DefinitionType";
|
||||
|
||||
fn value(&self) -> i32 {
|
||||
*self as i32
|
||||
}
|
||||
|
||||
fn from_i32(value: i32) -> ::std::option::Option<EthereumDefinitionType> {
|
||||
fn from_i32(value: i32) -> ::std::option::Option<DefinitionType> {
|
||||
match value {
|
||||
0 => ::std::option::Option::Some(EthereumDefinitionType::NETWORK),
|
||||
1 => ::std::option::Option::Some(EthereumDefinitionType::TOKEN),
|
||||
0 => ::std::option::Option::Some(DefinitionType::ETHEREUM_NETWORK),
|
||||
1 => ::std::option::Option::Some(DefinitionType::ETHEREUM_TOKEN),
|
||||
2 => ::std::option::Option::Some(DefinitionType::SOLANA_TOKEN),
|
||||
_ => ::std::option::Option::None
|
||||
}
|
||||
}
|
||||
|
||||
fn from_str(str: &str) -> ::std::option::Option<EthereumDefinitionType> {
|
||||
fn from_str(str: &str) -> ::std::option::Option<DefinitionType> {
|
||||
match str {
|
||||
"NETWORK" => ::std::option::Option::Some(EthereumDefinitionType::NETWORK),
|
||||
"TOKEN" => ::std::option::Option::Some(EthereumDefinitionType::TOKEN),
|
||||
"ETHEREUM_NETWORK" => ::std::option::Option::Some(DefinitionType::ETHEREUM_NETWORK),
|
||||
"ETHEREUM_TOKEN" => ::std::option::Option::Some(DefinitionType::ETHEREUM_TOKEN),
|
||||
"SOLANA_TOKEN" => ::std::option::Option::Some(DefinitionType::SOLANA_TOKEN),
|
||||
_ => ::std::option::Option::None
|
||||
}
|
||||
}
|
||||
|
||||
const VALUES: &'static [EthereumDefinitionType] = &[
|
||||
EthereumDefinitionType::NETWORK,
|
||||
EthereumDefinitionType::TOKEN,
|
||||
const VALUES: &'static [DefinitionType] = &[
|
||||
DefinitionType::ETHEREUM_NETWORK,
|
||||
DefinitionType::ETHEREUM_TOKEN,
|
||||
DefinitionType::SOLANA_TOKEN,
|
||||
];
|
||||
}
|
||||
|
||||
impl ::protobuf::EnumFull for EthereumDefinitionType {
|
||||
impl ::protobuf::EnumFull for DefinitionType {
|
||||
fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor {
|
||||
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new();
|
||||
descriptor.get(|| file_descriptor().enum_by_package_relative_name("EthereumDefinitionType").unwrap()).clone()
|
||||
descriptor.get(|| file_descriptor().enum_by_package_relative_name("DefinitionType").unwrap()).clone()
|
||||
}
|
||||
|
||||
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 {
|
||||
EthereumDefinitionType::NETWORK
|
||||
DefinitionType::ETHEREUM_NETWORK
|
||||
}
|
||||
}
|
||||
|
||||
impl EthereumDefinitionType {
|
||||
impl DefinitionType {
|
||||
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"\
|
||||
\n#messages-ethereum-definitions.proto\x12'hw.trezor.messages.ethereum_d\
|
||||
efinitions\"t\n\x13EthereumNetworkInfo\x12\x19\n\x08chain_id\x18\x01\x20\
|
||||
\x02(\x04R\x07chainId\x12\x16\n\x06symbol\x18\x02\x20\x02(\tR\x06symbol\
|
||||
\x12\x16\n\x06slip44\x18\x03\x20\x02(\rR\x06slip44\x12\x12\n\x04name\x18\
|
||||
\x04\x20\x02(\tR\x04name\"\x90\x01\n\x11EthereumTokenInfo\x12\x18\n\x07a\
|
||||
ddress\x18\x01\x20\x02(\x0cR\x07address\x12\x19\n\x08chain_id\x18\x02\
|
||||
\x20\x02(\x04R\x07chainId\x12\x16\n\x06symbol\x18\x03\x20\x02(\tR\x06sym\
|
||||
bol\x12\x1a\n\x08decimals\x18\x04\x20\x02(\rR\x08decimals\x12\x12\n\x04n\
|
||||
ame\x18\x05\x20\x02(\tR\x04name\"c\n\x13EthereumDefinitions\x12'\n\x0fen\
|
||||
coded_network\x18\x01\x20\x01(\x0cR\x0eencodedNetwork\x12#\n\rencoded_to\
|
||||
ken\x18\x02\x20\x01(\x0cR\x0cencodedToken*0\n\x16EthereumDefinitionType\
|
||||
\x12\x0b\n\x07NETWORK\x10\0\x12\t\n\x05TOKEN\x10\x01BG\n#com.satoshilabs\
|
||||
.trezor.lib.protobufB\x20TrezorMessageEthereumDefinitions\
|
||||
\n\x1amessages-definitions.proto\x12\x1ehw.trezor.messages.definitions\"\
|
||||
t\n\x13EthereumNetworkInfo\x12\x19\n\x08chain_id\x18\x01\x20\x02(\x04R\
|
||||
\x07chainId\x12\x16\n\x06symbol\x18\x02\x20\x02(\tR\x06symbol\x12\x16\n\
|
||||
\x06slip44\x18\x03\x20\x02(\rR\x06slip44\x12\x12\n\x04name\x18\x04\x20\
|
||||
\x02(\tR\x04name\"\x90\x01\n\x11EthereumTokenInfo\x12\x18\n\x07address\
|
||||
\x18\x01\x20\x02(\x0cR\x07address\x12\x19\n\x08chain_id\x18\x02\x20\x02(\
|
||||
\x04R\x07chainId\x12\x16\n\x06symbol\x18\x03\x20\x02(\tR\x06symbol\x12\
|
||||
\x1a\n\x08decimals\x18\x04\x20\x02(\rR\x08decimals\x12\x12\n\x04name\x18\
|
||||
\x05\x20\x02(\tR\x04name\"Q\n\x0fSolanaTokenInfo\x12\x12\n\x04mint\x18\
|
||||
\x01\x20\x02(\x0cR\x04mint\x12\x16\n\x06symbol\x18\x02\x20\x02(\tR\x06sy\
|
||||
mbol\x12\x12\n\x04name\x18\x03\x20\x02(\tR\x04name*L\n\x0eDefinitionType\
|
||||
\x12\x14\n\x10ETHEREUM_NETWORK\x10\0\x12\x12\n\x0eETHEREUM_TOKEN\x10\x01\
|
||||
\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
|
||||
@ -986,9 +1055,9 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
|
||||
let mut messages = ::std::vec::Vec::with_capacity(3);
|
||||
messages.push(EthereumNetworkInfo::generated_message_descriptor_data());
|
||||
messages.push(EthereumTokenInfo::generated_message_descriptor_data());
|
||||
messages.push(EthereumDefinitions::generated_message_descriptor_data());
|
||||
messages.push(SolanaTokenInfo::generated_message_descriptor_data());
|
||||
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(
|
||||
file_descriptor_proto(),
|
||||
deps,
|
@ -865,7 +865,7 @@ pub struct EthereumSignTx {
|
||||
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.tx_type)
|
||||
pub tx_type: ::std::option::Option<u32>,
|
||||
// @@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)
|
||||
pub chunkify: ::std::option::Option<bool>,
|
||||
// special fields
|
||||
@ -1229,7 +1229,7 @@ impl EthereumSignTx {
|
||||
|m: &EthereumSignTx| { &m.tx_type },
|
||||
|m: &mut EthereumSignTx| { &mut m.tx_type },
|
||||
));
|
||||
fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_ethereum_definitions::EthereumDefinitions>(
|
||||
fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EthereumDefinitions>(
|
||||
"definitions",
|
||||
|m: &EthereumSignTx| { &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)
|
||||
pub access_list: ::std::vec::Vec<ethereum_sign_tx_eip1559::EthereumAccessList>,
|
||||
// @@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)
|
||||
pub chunkify: ::std::option::Option<bool>,
|
||||
// special fields
|
||||
@ -1883,7 +1883,7 @@ impl EthereumSignTxEIP1559 {
|
||||
|m: &EthereumSignTxEIP1559| { &m.access_list },
|
||||
|m: &mut EthereumSignTxEIP1559| { &mut m.access_list },
|
||||
));
|
||||
fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_ethereum_definitions::EthereumDefinitions>(
|
||||
fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EthereumDefinitions>(
|
||||
"definitions",
|
||||
|m: &EthereumSignTxEIP1559| { &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>;
|
||||
}
|
||||
|
||||
// @@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"\
|
||||
\n\x17messages-ethereum.proto\x12\x1bhw.trezor.messages.ethereum\x1a\x15\
|
||||
messages-common.proto\x1a#messages-ethereum-definitions.proto\"V\n\x14Et\
|
||||
hereumGetPublicKey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\
|
||||
\x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\"b\n\x11Eth\
|
||||
ereumPublicKey\x129\n\x04node\x18\x01\x20\x02(\x0b2%.hw.trezor.messages.\
|
||||
common.HDNodeTypeR\x04node\x12\x12\n\x04xpub\x18\x02\x20\x02(\tR\x04xpub\
|
||||
\"\x99\x01\n\x12EthereumGetAddress\x12\x1b\n\taddress_n\x18\x01\x20\x03(\
|
||||
\rR\x08addressN\x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisp\
|
||||
lay\x12'\n\x0fencoded_network\x18\x03\x20\x01(\x0cR\x0eencodedNetwork\
|
||||
\x12\x1a\n\x08chunkify\x18\x04\x20\x01(\x08R\x08chunkify\"Q\n\x0fEthereu\
|
||||
mAddress\x12$\n\x0c_old_address\x18\x01\x20\x01(\x0cR\nOldAddressB\x02\
|
||||
\x18\x01\x12\x18\n\x07address\x18\x02\x20\x01(\tR\x07address\"\xad\x03\n\
|
||||
\x0eEthereumSignTx\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\
|
||||
\x12\x16\n\x05nonce\x18\x02\x20\x01(\x0c:\0R\x05nonce\x12\x1b\n\tgas_pri\
|
||||
ce\x18\x03\x20\x02(\x0cR\x08gasPrice\x12\x1b\n\tgas_limit\x18\x04\x20\
|
||||
\x02(\x0cR\x08gasLimit\x12\x10\n\x02to\x18\x0b\x20\x01(\t:\0R\x02to\x12\
|
||||
\x16\n\x05value\x18\x06\x20\x01(\x0c:\0R\x05value\x12.\n\x12data_initial\
|
||||
_chunk\x18\x07\x20\x01(\x0c:\0R\x10dataInitialChunk\x12\"\n\x0bdata_leng\
|
||||
th\x18\x08\x20\x01(\r:\x010R\ndataLength\x12\x19\n\x08chain_id\x18\t\x20\
|
||||
\x02(\x04R\x07chainId\x12\x17\n\x07tx_type\x18\n\x20\x01(\rR\x06txType\
|
||||
\x12^\n\x0bdefinitions\x18\x0c\x20\x01(\x0b2<.hw.trezor.messages.ethereu\
|
||||
m_definitions.EthereumDefinitionsR\x0bdefinitions\x12\x1a\n\x08chunkify\
|
||||
\x18\r\x20\x01(\x08R\x08chunkify\"\xfc\x04\n\x15EthereumSignTxEIP1559\
|
||||
\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x14\n\x05nonce\
|
||||
\x18\x02\x20\x02(\x0cR\x05nonce\x12\x1e\n\x0bmax_gas_fee\x18\x03\x20\x02\
|
||||
(\x0cR\tmaxGasFee\x12(\n\x10max_priority_fee\x18\x04\x20\x02(\x0cR\x0ema\
|
||||
xPriorityFee\x12\x1b\n\tgas_limit\x18\x05\x20\x02(\x0cR\x08gasLimit\x12\
|
||||
\x10\n\x02to\x18\x06\x20\x01(\t:\0R\x02to\x12\x14\n\x05value\x18\x07\x20\
|
||||
\x02(\x0cR\x05value\x12.\n\x12data_initial_chunk\x18\x08\x20\x01(\x0c:\0\
|
||||
R\x10dataInitialChunk\x12\x1f\n\x0bdata_length\x18\t\x20\x02(\rR\ndataLe\
|
||||
ngth\x12\x19\n\x08chain_id\x18\n\x20\x02(\x04R\x07chainId\x12f\n\x0bacce\
|
||||
ss_list\x18\x0b\x20\x03(\x0b2E.hw.trezor.messages.ethereum.EthereumSignT\
|
||||
xEIP1559.EthereumAccessListR\naccessList\x12^\n\x0bdefinitions\x18\x0c\
|
||||
\x20\x01(\x0b2<.hw.trezor.messages.ethereum_definitions.EthereumDefiniti\
|
||||
onsR\x0bdefinitions\x12\x1a\n\x08chunkify\x18\r\x20\x01(\x08R\x08chunkif\
|
||||
y\x1aQ\n\x12EthereumAccessList\x12\x18\n\x07address\x18\x01\x20\x02(\tR\
|
||||
\x07address\x12!\n\x0cstorage_keys\x18\x02\x20\x03(\x0cR\x0bstorageKeys\
|
||||
\"\x97\x01\n\x11EthereumTxRequest\x12\x1f\n\x0bdata_length\x18\x01\x20\
|
||||
\x01(\rR\ndataLength\x12\x1f\n\x0bsignature_v\x18\x02\x20\x01(\rR\nsigna\
|
||||
tureV\x12\x1f\n\x0bsignature_r\x18\x03\x20\x01(\x0cR\nsignatureR\x12\x1f\
|
||||
\n\x0bsignature_s\x18\x04\x20\x01(\x0cR\nsignatureS\".\n\rEthereumTxAck\
|
||||
\x12\x1d\n\ndata_chunk\x18\x01\x20\x02(\x0cR\tdataChunk\"\x91\x01\n\x13E\
|
||||
thereumSignMessage\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\
|
||||
\x12\x18\n\x07message\x18\x02\x20\x02(\x0cR\x07message\x12'\n\x0fencoded\
|
||||
_network\x18\x03\x20\x01(\x0cR\x0eencodedNetwork\x12\x1a\n\x08chunkify\
|
||||
\x18\x04\x20\x01(\x08R\x08chunkify\"R\n\x18EthereumMessageSignature\x12\
|
||||
\x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07address\
|
||||
\x18\x03\x20\x02(\tR\x07address\"\x85\x01\n\x15EthereumVerifyMessage\x12\
|
||||
\x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07message\
|
||||
\x18\x03\x20\x02(\x0cR\x07message\x12\x18\n\x07address\x18\x04\x20\x02(\
|
||||
\tR\x07address\x12\x1a\n\x08chunkify\x18\x05\x20\x01(\x08R\x08chunkify\"\
|
||||
\xb4\x01\n\x15EthereumSignTypedHash\x12\x1b\n\taddress_n\x18\x01\x20\x03\
|
||||
(\rR\x08addressN\x122\n\x15domain_separator_hash\x18\x02\x20\x02(\x0cR\
|
||||
\x13domainSeparatorHash\x12!\n\x0cmessage_hash\x18\x03\x20\x01(\x0cR\x0b\
|
||||
messageHash\x12'\n\x0fencoded_network\x18\x04\x20\x01(\x0cR\x0eencodedNe\
|
||||
twork\"T\n\x1aEthereumTypedDataSignature\x12\x1c\n\tsignature\x18\x01\
|
||||
\x20\x02(\x0cR\tsignature\x12\x18\n\x07address\x18\x02\x20\x02(\tR\x07ad\
|
||||
dressB<\n#com.satoshilabs.trezor.lib.protobufB\x15TrezorMessageEthereum\
|
||||
messages-common.proto\"V\n\x14EthereumGetPublicKey\x12\x1b\n\taddress_n\
|
||||
\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0cshow_display\x18\x02\x20\x01(\
|
||||
\x08R\x0bshowDisplay\"b\n\x11EthereumPublicKey\x129\n\x04node\x18\x01\
|
||||
\x20\x02(\x0b2%.hw.trezor.messages.common.HDNodeTypeR\x04node\x12\x12\n\
|
||||
\x04xpub\x18\x02\x20\x02(\tR\x04xpub\"\x99\x01\n\x12EthereumGetAddress\
|
||||
\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0cshow_dis\
|
||||
play\x18\x02\x20\x01(\x08R\x0bshowDisplay\x12'\n\x0fencoded_network\x18\
|
||||
\x03\x20\x01(\x0cR\x0eencodedNetwork\x12\x1a\n\x08chunkify\x18\x04\x20\
|
||||
\x01(\x08R\x08chunkify\"Q\n\x0fEthereumAddress\x12$\n\x0c_old_address\
|
||||
\x18\x01\x20\x01(\x0cR\nOldAddressB\x02\x18\x01\x12\x18\n\x07address\x18\
|
||||
\x02\x20\x01(\tR\x07address\"\xa1\x03\n\x0eEthereumSignTx\x12\x1b\n\tadd\
|
||||
ress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x16\n\x05nonce\x18\x02\x20\
|
||||
\x01(\x0c:\0R\x05nonce\x12\x1b\n\tgas_price\x18\x03\x20\x02(\x0cR\x08gas\
|
||||
Price\x12\x1b\n\tgas_limit\x18\x04\x20\x02(\x0cR\x08gasLimit\x12\x10\n\
|
||||
\x02to\x18\x0b\x20\x01(\t:\0R\x02to\x12\x16\n\x05value\x18\x06\x20\x01(\
|
||||
\x0c:\0R\x05value\x12.\n\x12data_initial_chunk\x18\x07\x20\x01(\x0c:\0R\
|
||||
\x10dataInitialChunk\x12\"\n\x0bdata_length\x18\x08\x20\x01(\r:\x010R\nd\
|
||||
ataLength\x12\x19\n\x08chain_id\x18\t\x20\x02(\x04R\x07chainId\x12\x17\n\
|
||||
\x07tx_type\x18\n\x20\x01(\rR\x06txType\x12R\n\x0bdefinitions\x18\x0c\
|
||||
\x20\x01(\x0b20.hw.trezor.messages.ethereum.EthereumDefinitionsR\x0bdefi\
|
||||
nitions\x12\x1a\n\x08chunkify\x18\r\x20\x01(\x08R\x08chunkify\"\xf0\x04\
|
||||
\n\x15EthereumSignTxEIP1559\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08\
|
||||
addressN\x12\x14\n\x05nonce\x18\x02\x20\x02(\x0cR\x05nonce\x12\x1e\n\x0b\
|
||||
max_gas_fee\x18\x03\x20\x02(\x0cR\tmaxGasFee\x12(\n\x10max_priority_fee\
|
||||
\x18\x04\x20\x02(\x0cR\x0emaxPriorityFee\x12\x1b\n\tgas_limit\x18\x05\
|
||||
\x20\x02(\x0cR\x08gasLimit\x12\x10\n\x02to\x18\x06\x20\x01(\t:\0R\x02to\
|
||||
\x12\x14\n\x05value\x18\x07\x20\x02(\x0cR\x05value\x12.\n\x12data_initia\
|
||||
l_chunk\x18\x08\x20\x01(\x0c:\0R\x10dataInitialChunk\x12\x1f\n\x0bdata_l\
|
||||
ength\x18\t\x20\x02(\rR\ndataLength\x12\x19\n\x08chain_id\x18\n\x20\x02(\
|
||||
\x04R\x07chainId\x12f\n\x0baccess_list\x18\x0b\x20\x03(\x0b2E.hw.trezor.\
|
||||
messages.ethereum.EthereumSignTxEIP1559.EthereumAccessListR\naccessList\
|
||||
\x12R\n\x0bdefinitions\x18\x0c\x20\x01(\x0b20.hw.trezor.messages.ethereu\
|
||||
m.EthereumDefinitionsR\x0bdefinitions\x12\x1a\n\x08chunkify\x18\r\x20\
|
||||
\x01(\x08R\x08chunkify\x1aQ\n\x12EthereumAccessList\x12\x18\n\x07address\
|
||||
\x18\x01\x20\x02(\tR\x07address\x12!\n\x0cstorage_keys\x18\x02\x20\x03(\
|
||||
\x0cR\x0bstorageKeys\"\x97\x01\n\x11EthereumTxRequest\x12\x1f\n\x0bdata_\
|
||||
length\x18\x01\x20\x01(\rR\ndataLength\x12\x1f\n\x0bsignature_v\x18\x02\
|
||||
\x20\x01(\rR\nsignatureV\x12\x1f\n\x0bsignature_r\x18\x03\x20\x01(\x0cR\
|
||||
\nsignatureR\x12\x1f\n\x0bsignature_s\x18\x04\x20\x01(\x0cR\nsignatureS\
|
||||
\".\n\rEthereumTxAck\x12\x1d\n\ndata_chunk\x18\x01\x20\x02(\x0cR\tdataCh\
|
||||
unk\"\x91\x01\n\x13EthereumSignMessage\x12\x1b\n\taddress_n\x18\x01\x20\
|
||||
\x03(\rR\x08addressN\x12\x18\n\x07message\x18\x02\x20\x02(\x0cR\x07messa\
|
||||
ge\x12'\n\x0fencoded_network\x18\x03\x20\x01(\x0cR\x0eencodedNetwork\x12\
|
||||
\x1a\n\x08chunkify\x18\x04\x20\x01(\x08R\x08chunkify\"R\n\x18EthereumMes\
|
||||
sageSignature\x12\x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\
|
||||
\x18\n\x07address\x18\x03\x20\x02(\tR\x07address\"\x85\x01\n\x15Ethereum\
|
||||
VerifyMessage\x12\x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\
|
||||
\x18\n\x07message\x18\x03\x20\x02(\x0cR\x07message\x12\x18\n\x07address\
|
||||
\x18\x04\x20\x02(\tR\x07address\x12\x1a\n\x08chunkify\x18\x05\x20\x01(\
|
||||
\x08R\x08chunkify\"\xb4\x01\n\x15EthereumSignTypedHash\x12\x1b\n\taddres\
|
||||
s_n\x18\x01\x20\x03(\rR\x08addressN\x122\n\x15domain_separator_hash\x18\
|
||||
\x02\x20\x02(\x0cR\x13domainSeparatorHash\x12!\n\x0cmessage_hash\x18\x03\
|
||||
\x20\x01(\x0cR\x0bmessageHash\x12'\n\x0fencoded_network\x18\x04\x20\x01(\
|
||||
\x0cR\x0eencodedNetwork\"T\n\x1aEthereumTypedDataSignature\x12\x1c\n\tsi\
|
||||
gnature\x18\x01\x20\x02(\x0cR\tsignature\x12\x18\n\x07address\x18\x02\
|
||||
\x20\x02(\tR\x07address\"c\n\x13EthereumDefinitions\x12'\n\x0fencoded_ne\
|
||||
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
|
||||
@ -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();
|
||||
file_descriptor.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_ethereum_definitions::file_descriptor().clone());
|
||||
let mut messages = ::std::vec::Vec::with_capacity(14);
|
||||
let mut messages = ::std::vec::Vec::with_capacity(15);
|
||||
messages.push(EthereumGetPublicKey::generated_message_descriptor_data());
|
||||
messages.push(EthereumPublicKey::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(EthereumSignTypedHash::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());
|
||||
let mut enums = ::std::vec::Vec::with_capacity(0);
|
||||
::protobuf::reflect::GeneratedFileDescriptor::new_generated(
|
||||
|
@ -36,7 +36,7 @@ pub struct EthereumSignTypedData {
|
||||
// @@protoc_insertion_point(field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.metamask_v4_compat)
|
||||
pub metamask_v4_compat: ::std::option::Option<bool>,
|
||||
// @@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
|
||||
// @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum_eip712.EthereumSignTypedData.special_fields)
|
||||
pub special_fields: ::protobuf::SpecialFields,
|
||||
@ -126,7 +126,7 @@ impl EthereumSignTypedData {
|
||||
|m: &EthereumSignTypedData| { &m.metamask_v4_compat },
|
||||
|m: &mut EthereumSignTypedData| { &mut m.metamask_v4_compat },
|
||||
));
|
||||
fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_ethereum_definitions::EthereumDefinitions>(
|
||||
fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::messages_ethereum::EthereumDefinitions>(
|
||||
"definitions",
|
||||
|m: &EthereumSignTypedData| { &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"\
|
||||
\n\x1emessages-ethereum-eip712.proto\x12\"hw.trezor.messages.ethereum_ei\
|
||||
p712\x1a#messages-ethereum-definitions.proto\"\xeb\x01\n\x15EthereumSign\
|
||||
TypedData\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\
|
||||
\x0cprimary_type\x18\x02\x20\x02(\tR\x0bprimaryType\x122\n\x12metamask_v\
|
||||
4_compat\x18\x03\x20\x01(\x08:\x04trueR\x10metamaskV4Compat\x12^\n\x0bde\
|
||||
finitions\x18\x04\x20\x01(\x0b2<.hw.trezor.messages.ethereum_definitions\
|
||||
.EthereumDefinitionsR\x0bdefinitions\"4\n\x1eEthereumTypedDataStructRequ\
|
||||
est\x12\x12\n\x04name\x18\x01\x20\x02(\tR\x04name\"\xb4\x05\n\x1aEthereu\
|
||||
mTypedDataStructAck\x12m\n\x07members\x18\x01\x20\x03(\x0b2S.hw.trezor.m\
|
||||
essages.ethereum_eip712.EthereumTypedDataStructAck.EthereumStructMemberR\
|
||||
\x07members\x1a\x90\x01\n\x14EthereumStructMember\x12d\n\x04type\x18\x01\
|
||||
\x20\x02(\x0b2P.hw.trezor.messages.ethereum_eip712.EthereumTypedDataStru\
|
||||
ctAck.EthereumFieldTypeR\x04type\x12\x12\n\x04name\x18\x02\x20\x02(\tR\
|
||||
\x04name\x1a\xa7\x02\n\x11EthereumFieldType\x12l\n\tdata_type\x18\x01\
|
||||
\x20\x02(\x0e2O.hw.trezor.messages.ethereum_eip712.EthereumTypedDataStru\
|
||||
ctAck.EthereumDataTypeR\x08dataType\x12\x12\n\x04size\x18\x02\x20\x01(\r\
|
||||
R\x04size\x12o\n\nentry_type\x18\x03\x20\x01(\x0b2P.hw.trezor.messages.e\
|
||||
thereum_eip712.EthereumTypedDataStructAck.EthereumFieldTypeR\tentryType\
|
||||
\x12\x1f\n\x0bstruct_name\x18\x04\x20\x01(\tR\nstructName\"j\n\x10Ethere\
|
||||
umDataType\x12\x08\n\x04UINT\x10\x01\x12\x07\n\x03INT\x10\x02\x12\t\n\
|
||||
\x05BYTES\x10\x03\x12\n\n\x06STRING\x10\x04\x12\x08\n\x04BOOL\x10\x05\
|
||||
\x12\x0b\n\x07ADDRESS\x10\x06\x12\t\n\x05ARRAY\x10\x07\x12\n\n\x06STRUCT\
|
||||
\x10\x08\"@\n\x1dEthereumTypedDataValueRequest\x12\x1f\n\x0bmember_path\
|
||||
\x18\x01\x20\x03(\rR\nmemberPath\"1\n\x19EthereumTypedDataValueAck\x12\
|
||||
\x14\n\x05value\x18\x01\x20\x02(\x0cR\x05valueBB\n#com.satoshilabs.trezo\
|
||||
r.lib.protobufB\x1bTrezorMessageEthereumEIP712\
|
||||
p712\x1a\x17messages-ethereum.proto\"\xdf\x01\n\x15EthereumSignTypedData\
|
||||
\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12!\n\x0cprimary_\
|
||||
type\x18\x02\x20\x02(\tR\x0bprimaryType\x122\n\x12metamask_v4_compat\x18\
|
||||
\x03\x20\x01(\x08:\x04trueR\x10metamaskV4Compat\x12R\n\x0bdefinitions\
|
||||
\x18\x04\x20\x01(\x0b20.hw.trezor.messages.ethereum.EthereumDefinitionsR\
|
||||
\x0bdefinitions\"4\n\x1eEthereumTypedDataStructRequest\x12\x12\n\x04name\
|
||||
\x18\x01\x20\x02(\tR\x04name\"\xb4\x05\n\x1aEthereumTypedDataStructAck\
|
||||
\x12m\n\x07members\x18\x01\x20\x03(\x0b2S.hw.trezor.messages.ethereum_ei\
|
||||
p712.EthereumTypedDataStructAck.EthereumStructMemberR\x07members\x1a\x90\
|
||||
\x01\n\x14EthereumStructMember\x12d\n\x04type\x18\x01\x20\x02(\x0b2P.hw.\
|
||||
trezor.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumField\
|
||||
TypeR\x04type\x12\x12\n\x04name\x18\x02\x20\x02(\tR\x04name\x1a\xa7\x02\
|
||||
\n\x11EthereumFieldType\x12l\n\tdata_type\x18\x01\x20\x02(\x0e2O.hw.trez\
|
||||
or.messages.ethereum_eip712.EthereumTypedDataStructAck.EthereumDataTypeR\
|
||||
\x08dataType\x12\x12\n\x04size\x18\x02\x20\x01(\rR\x04size\x12o\n\nentry\
|
||||
_type\x18\x03\x20\x01(\x0b2P.hw.trezor.messages.ethereum_eip712.Ethereum\
|
||||
TypedDataStructAck.EthereumFieldTypeR\tentryType\x12\x1f\n\x0bstruct_nam\
|
||||
e\x18\x04\x20\x01(\tR\nstructName\"j\n\x10EthereumDataType\x12\x08\n\x04\
|
||||
UINT\x10\x01\x12\x07\n\x03INT\x10\x02\x12\t\n\x05BYTES\x10\x03\x12\n\n\
|
||||
\x06STRING\x10\x04\x12\x08\n\x04BOOL\x10\x05\x12\x0b\n\x07ADDRESS\x10\
|
||||
\x06\x12\t\n\x05ARRAY\x10\x07\x12\n\n\x06STRUCT\x10\x08\"@\n\x1dEthereum\
|
||||
TypedDataValueRequest\x12\x1f\n\x0bmember_path\x18\x01\x20\x03(\rR\nmemb\
|
||||
erPath\"1\n\x19EthereumTypedDataValueAck\x12\x14\n\x05value\x18\x01\x20\
|
||||
\x02(\x0cR\x05valueBB\n#com.satoshilabs.trezor.lib.protobufB\x1bTrezorMe\
|
||||
ssageEthereumEIP712\
|
||||
";
|
||||
|
||||
/// `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(|| {
|
||||
let generated_file_descriptor = generated_file_descriptor_lazy.get(|| {
|
||||
let mut deps = ::std::vec::Vec::with_capacity(1);
|
||||
deps.push(super::messages_ethereum_definitions::file_descriptor().clone());
|
||||
deps.push(super::messages_ethereum::file_descriptor().clone());
|
||||
let mut messages = ::std::vec::Vec::with_capacity(7);
|
||||
messages.push(EthereumSignTypedData::generated_message_descriptor_data());
|
||||
messages.push(EthereumTypedDataStructRequest::generated_message_descriptor_data());
|
||||
|
@ -1046,6 +1046,8 @@ pub struct SolanaTxAdditionalInfo {
|
||||
// message fields
|
||||
// @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaTxAdditionalInfo.token_accounts_infos)
|
||||
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
|
||||
// @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaTxAdditionalInfo.special_fields)
|
||||
pub special_fields: ::protobuf::SpecialFields,
|
||||
@ -1062,14 +1064,55 @@ impl SolanaTxAdditionalInfo {
|
||||
::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 {
|
||||
let mut fields = ::std::vec::Vec::with_capacity(1);
|
||||
let mut fields = ::std::vec::Vec::with_capacity(2);
|
||||
let mut oneofs = ::std::vec::Vec::with_capacity(0);
|
||||
fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>(
|
||||
"token_accounts_infos",
|
||||
|m: &SolanaTxAdditionalInfo| { &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>(
|
||||
"SolanaTxAdditionalInfo",
|
||||
fields,
|
||||
@ -1096,6 +1139,9 @@ impl ::protobuf::Message for SolanaTxAdditionalInfo {
|
||||
10 => {
|
||||
self.token_accounts_infos.push(is.read_message()?);
|
||||
},
|
||||
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())?;
|
||||
},
|
||||
@ -1112,6 +1158,9 @@ impl ::protobuf::Message for SolanaTxAdditionalInfo {
|
||||
let len = value.compute_size();
|
||||
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());
|
||||
self.special_fields.cached_size().set(my_size as u32);
|
||||
my_size
|
||||
@ -1121,6 +1170,9 @@ impl ::protobuf::Message for SolanaTxAdditionalInfo {
|
||||
for v in &self.token_accounts_infos {
|
||||
::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())?;
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
@ -1139,12 +1191,14 @@ impl ::protobuf::Message for SolanaTxAdditionalInfo {
|
||||
|
||||
fn clear(&mut self) {
|
||||
self.token_accounts_infos.clear();
|
||||
self.encoded_token = ::std::option::Option::None;
|
||||
self.special_fields.clear();
|
||||
}
|
||||
|
||||
fn default_instance() -> &'static SolanaTxAdditionalInfo {
|
||||
static instance: SolanaTxAdditionalInfo = SolanaTxAdditionalInfo {
|
||||
token_accounts_infos: ::std::vec::Vec::new(),
|
||||
encoded_token: ::std::option::Option::None,
|
||||
special_fields: ::protobuf::SpecialFields::new(),
|
||||
};
|
||||
&instance
|
||||
@ -1547,14 +1601,15 @@ static file_descriptor_proto_data: &'static [u8] = b"\
|
||||
TokenAccountInfo\x12!\n\x0cbase_address\x18\x01\x20\x02(\tR\x0bbaseAddre\
|
||||
ss\x12#\n\rtoken_program\x18\x02\x20\x02(\tR\x0ctokenProgram\x12\x1d\n\n\
|
||||
token_mint\x18\x03\x20\x02(\tR\ttokenMint\x12#\n\rtoken_account\x18\x04\
|
||||
\x20\x02(\tR\x0ctokenAccount\"\x7f\n\x16SolanaTxAdditionalInfo\x12e\n\
|
||||
\x14token_accounts_infos\x18\x01\x20\x03(\x0b23.hw.trezor.messages.solan\
|
||||
a.SolanaTxTokenAccountInfoR\x12tokenAccountsInfos\"\xac\x01\n\x0cSolanaS\
|
||||
ignTx\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12#\n\rseria\
|
||||
lized_tx\x18\x02\x20\x02(\x0cR\x0cserializedTx\x12Z\n\x0fadditional_info\
|
||||
\x18\x03\x20\x01(\x0b21.hw.trezor.messages.solana.SolanaTxAdditionalInfo\
|
||||
R\x0eadditionalInfo\"1\n\x11SolanaTxSignature\x12\x1c\n\tsignature\x18\
|
||||
\x01\x20\x02(\x0cR\tsignature\
|
||||
\x20\x02(\tR\x0ctokenAccount\"\xa4\x01\n\x16SolanaTxAdditionalInfo\x12e\
|
||||
\n\x14token_accounts_infos\x18\x01\x20\x03(\x0b23.hw.trezor.messages.sol\
|
||||
ana.SolanaTxTokenAccountInfoR\x12tokenAccountsInfos\x12#\n\rencoded_toke\
|
||||
n\x18\x02\x20\x01(\x0cR\x0cencodedToken\"\xac\x01\n\x0cSolanaSignTx\x12\
|
||||
\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12#\n\rserialized_tx\
|
||||
\x18\x02\x20\x02(\x0cR\x0cserializedTx\x12Z\n\x0fadditional_info\x18\x03\
|
||||
\x20\x01(\x0b21.hw.trezor.messages.solana.SolanaTxAdditionalInfoR\x0eadd\
|
||||
itionalInfo\"1\n\x11SolanaTxSignature\x12\x1c\n\tsignature\x18\x01\x20\
|
||||
\x02(\x0cR\tsignature\
|
||||
";
|
||||
|
||||
/// `FileDescriptorProto` object which was a source for this generated file
|
||||
|
@ -21,6 +21,7 @@ mod generated {
|
||||
messages_common
|
||||
messages_crypto
|
||||
messages_debug
|
||||
messages_definitions
|
||||
messages_management
|
||||
messages_benchmark
|
||||
options
|
||||
@ -28,7 +29,6 @@ mod generated {
|
||||
"bitcoin" => messages_bitcoin
|
||||
"ethereum" => messages_ethereum
|
||||
"ethereum" => messages_ethereum_eip712
|
||||
"ethereum" => messages_ethereum_definitions
|
||||
"binance" => messages_binance
|
||||
"cardano" => messages_cardano
|
||||
"eos" => messages_eos
|
||||
|
Loading…
Reference in New Issue
Block a user