|
| 1 | +syntax = "proto2"; |
| 2 | +package hw.trezor.messages.ethereum_onekey; |
| 3 | + |
| 4 | +// Sugar for easier handling in Java |
| 5 | +option java_package = "com.satoshilabs.trezor.lib.protobuf"; |
| 6 | +option java_outer_classname = "TrezorMessageEthereumOnekey"; |
| 7 | + |
| 8 | +import "messages-common.proto"; |
| 9 | + |
| 10 | + |
| 11 | +/** |
| 12 | + * Request: Ask device for public key corresponding to address_n path |
| 13 | + * @start |
| 14 | + * @next EthereumGetPublicKeyOneKey |
| 15 | + * @next Failure |
| 16 | + */ |
| 17 | +message EthereumGetPublicKeyOneKey { |
| 18 | + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node |
| 19 | + optional bool show_display = 2; // optionally show on display before sending the result |
| 20 | + optional uint64 chain_id = 3; // used to personalized display |
| 21 | +} |
| 22 | + |
| 23 | +/** |
| 24 | + * Response: Contains public key derived from device private seed |
| 25 | + * @end |
| 26 | + */ |
| 27 | +message EthereumPublicKeyOneKey { |
| 28 | + required hw.trezor.messages.common.HDNodeType node = 1; // BIP32 public node |
| 29 | + required string xpub = 2; // serialized form of public node |
| 30 | +} |
| 31 | + |
| 32 | +/** |
| 33 | + * Request: Ask device for Ethereum address corresponding to address_n path |
| 34 | + * @start |
| 35 | + * @next EthereumAddressOneKey |
| 36 | + * @next Failure |
| 37 | + */ |
| 38 | +message EthereumGetAddressOneKey { |
| 39 | + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node |
| 40 | + optional bool show_display = 2; // optionally show on display before sending the result |
| 41 | + optional uint64 chain_id = 3; // used to personalized display |
| 42 | +} |
| 43 | + |
| 44 | +/** |
| 45 | + * Response: Contains an Ethereum address derived from device private seed |
| 46 | + * @end |
| 47 | + */ |
| 48 | +message EthereumAddressOneKey { |
| 49 | + optional bytes _old_address = 1 [deprecated=true]; // trezor <1.8.0, <2.1.0 - raw bytes of Ethereum address |
| 50 | + optional string address = 2; // Ethereum address as hex-encoded string |
| 51 | +} |
| 52 | + |
| 53 | +/** |
| 54 | + * Request: Ask device to sign transaction |
| 55 | + * gas_price, gas_limit and chain_id must be provided and non-zero. |
| 56 | + * All other fields are optional and default to value `0` if missing. |
| 57 | + * Note: the first at most 1024 bytes of data MUST be transmitted as part of this message. |
| 58 | + * @start |
| 59 | + * @next EthereumTxRequestOnekey |
| 60 | + * @next Failure |
| 61 | + */ |
| 62 | +message EthereumSignTxOneKey { |
| 63 | + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node |
| 64 | + optional bytes nonce = 2 [default='']; // <=256 bit unsigned big endian |
| 65 | + required bytes gas_price = 3; // <=256 bit unsigned big endian (in wei) |
| 66 | + required bytes gas_limit = 4; // <=256 bit unsigned big endian |
| 67 | + optional string to = 11 [default='']; // recipient address |
| 68 | + optional bytes value = 6 [default='']; // <=256 bit unsigned big endian (in wei) |
| 69 | + optional bytes data_initial_chunk = 7 [default='']; // The initial data chunk (<= 1024 bytes) |
| 70 | + optional uint32 data_length = 8 [default=0]; // Length of transaction payload |
| 71 | + required uint64 chain_id = 9; // Chain Id for EIP 155 |
| 72 | + optional uint32 tx_type = 10; // Used for Wanchain |
| 73 | +} |
| 74 | + |
| 75 | +/** |
| 76 | + * Request: Ask device to sign EIP1559 transaction |
| 77 | + * Note: the first at most 1024 bytes of data MUST be transmitted as part of this message. |
| 78 | + * @start |
| 79 | + * @next EthereumTxRequestOneKey |
| 80 | + * @next Failure |
| 81 | + */ |
| 82 | +message EthereumSignTxEIP1559OneKey { |
| 83 | + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node |
| 84 | + required bytes nonce = 2; // <=256 bit unsigned big endian |
| 85 | + required bytes max_gas_fee = 3; // <=256 bit unsigned big endian (in wei) |
| 86 | + required bytes max_priority_fee = 4; // <=256 bit unsigned big endian (in wei) |
| 87 | + required bytes gas_limit = 5; // <=256 bit unsigned big endian |
| 88 | + optional string to = 6 [default='']; // recipient address |
| 89 | + required bytes value = 7; // <=256 bit unsigned big endian (in wei) |
| 90 | + optional bytes data_initial_chunk = 8 [default='']; // The initial data chunk (<= 1024 bytes) |
| 91 | + required uint32 data_length = 9; // Length of transaction payload |
| 92 | + required uint64 chain_id = 10; // Chain Id for EIP 155 |
| 93 | + repeated EthereumAccessListOneKey access_list = 11; // Access List |
| 94 | + |
| 95 | + message EthereumAccessListOneKey { |
| 96 | + required string address = 1; |
| 97 | + repeated bytes storage_keys = 2; |
| 98 | + } |
| 99 | +} |
| 100 | + |
| 101 | +/** |
| 102 | + * Response: Device asks for more data from transaction payload, or returns the signature. |
| 103 | + * If data_length is set, device awaits that many more bytes of payload. |
| 104 | + * Otherwise, the signature_* fields contain the computed transaction signature. All three fields will be present. |
| 105 | + * @end |
| 106 | + * @next EthereumTxAckOneKey |
| 107 | + */ |
| 108 | +message EthereumTxRequestOneKey { |
| 109 | + optional uint32 data_length = 1; // Number of bytes being requested (<= 1024) |
| 110 | + optional uint32 signature_v = 2; // Computed signature (recovery parameter, limited to 27 or 28) |
| 111 | + optional bytes signature_r = 3; // Computed signature R component (256 bit) |
| 112 | + optional bytes signature_s = 4; // Computed signature S component (256 bit) |
| 113 | +} |
| 114 | + |
| 115 | +/** |
| 116 | + * Request: Transaction payload data. |
| 117 | + * @next EthereumTxRequestOneKey |
| 118 | + */ |
| 119 | +message EthereumTxAckOneKey { |
| 120 | + required bytes data_chunk = 1; // Bytes from transaction payload (<= 1024 bytes) |
| 121 | +} |
| 122 | + |
| 123 | +/** |
| 124 | + * Request: Ask device to sign message |
| 125 | + * @start |
| 126 | + * @next EthereumMessageSignatureOneKey |
| 127 | + * @next Failure |
| 128 | + */ |
| 129 | +message EthereumSignMessageOneKey { |
| 130 | + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node |
| 131 | + required bytes message = 2; // message to be signed |
| 132 | + optional uint64 chain_id = 3; // used to personalized display |
| 133 | +} |
| 134 | + |
| 135 | +/** |
| 136 | + * Response: Signed message |
| 137 | + * @end |
| 138 | + */ |
| 139 | +message EthereumMessageSignatureOneKey { |
| 140 | + required bytes signature = 2; // signature of the message |
| 141 | + required string address = 3; // address used to sign the message |
| 142 | +} |
| 143 | + |
| 144 | +/** |
| 145 | + * Request: Ask device to verify message |
| 146 | + * @start |
| 147 | + * @next Success |
| 148 | + * @next Failure |
| 149 | + */ |
| 150 | +message EthereumVerifyMessageOneKey { |
| 151 | + required bytes signature = 2; // signature to verify |
| 152 | + required bytes message = 3; // message to verify |
| 153 | + required string address = 4; // address to verify |
| 154 | + optional uint64 chain_id = 5; // used to personalized display |
| 155 | +} |
| 156 | + |
| 157 | +/** |
| 158 | + * Request: Ask device to sign hash of typed data |
| 159 | + * @start |
| 160 | + * @next EthereumTypedDataSignatureOneKey |
| 161 | + * @next Failure |
| 162 | + */ |
| 163 | +message EthereumSignTypedHashOneKey { |
| 164 | + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node |
| 165 | + required bytes domain_separator_hash = 2; // Hash of domainSeparator of typed data to be signed |
| 166 | + optional bytes message_hash = 3; // Hash of the data of typed data to be signed (empty if domain-only data) |
| 167 | + optional uint64 chain_id = 4; // used to personalized display |
| 168 | +} |
| 169 | + |
| 170 | +/** |
| 171 | + * Response: Signed typed data |
| 172 | + * @end |
| 173 | + */ |
| 174 | +message EthereumTypedDataSignatureOneKey { |
| 175 | + required bytes signature = 1; // signature of the typed data |
| 176 | + required string address = 2; // address used to sign the typed data |
| 177 | +} |
| 178 | + |
| 179 | + |
| 180 | +/** |
| 181 | + * Request: Ask device to sign message EIP712 |
| 182 | + * @start |
| 183 | + * @next EthereumMessageSignature |
| 184 | + * @next Failure |
| 185 | + */ |
| 186 | +message EthereumSignMessageEIP712 { |
| 187 | + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node |
| 188 | + optional bytes domain_hash = 2; // domainSeparator hash |
| 189 | + optional bytes message_hash = 3; // message hash |
| 190 | +} |
| 191 | + |
0 commit comments