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
}