diff --git a/accounts/usbwallet/trezor.go b/accounts/usbwallet/trezor.go index d4862d161b7b..fc7cec9afda2 100644 --- a/accounts/usbwallet/trezor.go +++ b/accounts/usbwallet/trezor.go @@ -50,6 +50,8 @@ var ErrTrezorPassphraseNeeded = errors.New("trezor: passphrase needed") // is in browser mode. var errTrezorReplyInvalidHeader = errors.New("trezor: invalid reply header") +const trezorMaxDataChunk = 1024 + // trezorDriver implements the communication with a Trezor hardware wallet. type trezorDriver struct { device io.ReadWriter // USB device connection to communicate through @@ -197,10 +199,7 @@ func (w *trezorDriver) trezorDerive(derivationPath []uint32) (common.Address, er if _, err := w.trezorExchange(&trezor.EthereumGetAddress{AddressN: derivationPath}, address); err != nil { return common.Address{}, err } - if addr := address.GetAddressBin(); len(addr) > 0 { // Older firmwares use binary formats - return common.BytesToAddress(addr), nil - } - if addr := address.GetAddressHex(); len(addr) > 0 { // Newer firmwares use hexadecimal formats + if addr := address.GetAddress(); addr != "" { return common.HexToAddress(addr), nil } return common.Address{}, errors.New("missing derived address") @@ -209,41 +208,24 @@ func (w *trezorDriver) trezorDerive(derivationPath []uint32) (common.Address, er // trezorSign sends the transaction to the Trezor wallet, and waits for the user // to confirm or deny the transaction. func (w *trezorDriver) trezorSign(derivationPath []uint32, tx *types.Transaction, chainID *big.Int) (common.Address, *types.Transaction, error) { - // Create the transaction initiation message - data := tx.Data() - length := uint32(len(data)) - - request := &trezor.EthereumSignTx{ - AddressN: derivationPath, - Nonce: new(big.Int).SetUint64(tx.Nonce()).Bytes(), - GasPrice: tx.GasPrice().Bytes(), - GasLimit: new(big.Int).SetUint64(tx.Gas()).Bytes(), - Value: tx.Value().Bytes(), - DataLength: &length, - } - if to := tx.To(); to != nil { - // Non contract deploy, set recipient explicitly - hex := to.Hex() - request.ToHex = &hex // Newer firmwares (old will ignore) - request.ToBin = (*to)[:] // Older firmwares (new will ignore) - } - if length > 1024 { // Send the data chunked if that was requested - request.DataInitialChunk, data = data[:1024], data[1024:] - } else { - request.DataInitialChunk, data = data, nil + request, payload, err := w.buildSignRequest(derivationPath, tx, chainID) + if err != nil { + return common.Address{}, nil, err } - if chainID != nil { // EIP-155 transaction, set chain ID explicitly (only 32 bit is supported!?) - id := uint32(chainID.Int64()) - request.ChainId = &id + if len(payload) > trezorMaxDataChunk { + setInitialChunk(request, payload[:trezorMaxDataChunk]) + payload = payload[trezorMaxDataChunk:] + } else { + setInitialChunk(request, payload) + payload = nil } - // Send the initiation message and stream content until a signature is returned response := new(trezor.EthereumTxRequest) if _, err := w.trezorExchange(request, response); err != nil { return common.Address{}, nil, err } - for response.DataLength != nil && int(*response.DataLength) <= len(data) { - chunk := data[:*response.DataLength] - data = data[*response.DataLength:] + for response.DataLength != nil && int(*response.DataLength) <= len(payload) { + chunk := payload[:*response.DataLength] + payload = payload[*response.DataLength:] if _, err := w.trezorExchange(&trezor.EthereumTxAck{DataChunk: chunk}, response); err != nil { return common.Address{}, nil, err @@ -261,15 +243,21 @@ func (w *trezorDriver) trezorSign(derivationPath []uint32, tx *types.Transaction // Create the correct signer and signature transform based on the chain ID var signer types.Signer + legacyTx := tx.Type() == types.LegacyTxType if chainID == nil { signer = new(types.HomesteadSigner) } else { - // Trezor backend does not support typed transactions yet. - signer = types.NewEIP155Signer(chainID) - // if chainId is above (MaxUint32 - 36) / 2 then the final v values is returned - // directly. Otherwise, the returned value is 35 + chainid * 2. - if signature[64] > 1 && int(chainID.Int64()) <= (math.MaxUint32-36)/2 { - signature[64] -= byte(chainID.Uint64()*2 + 35) + signer = types.LatestSignerForChainID(chainID) + // Legacy (EIP-155) transactions still return the final ECDSA V value. + if legacyTx && signature[64] > 1 { + if !chainID.IsUint64() { + return common.Address{}, nil, errors.New("chain id overflows uint64") + } + sigAdj := chainID.Uint64()*2 + 35 + if sigAdj > math.MaxUint8 { + return common.Address{}, nil, errors.New("chain id is too large for trezor response") + } + signature[64] -= byte(sigAdj) } } @@ -285,6 +273,126 @@ func (w *trezorDriver) trezorSign(derivationPath []uint32, tx *types.Transaction return sender, signed, nil } +func (w *trezorDriver) buildSignRequest(derivationPath []uint32, tx *types.Transaction, chainID *big.Int) (proto.Message, []byte, error) { + payload := tx.Data() + length := uint32(len(payload)) + switch tx.Type() { + case types.LegacyTxType: + req := &trezor.EthereumSignTx{ + AddressN: derivationPath, + Nonce: encodeUint64(tx.Nonce()), + GasPrice: bigIntBytes(tx.GasPrice()), + GasLimit: encodeUint64(tx.Gas()), + Value: bigIntBytes(tx.Value()), + DataLength: &length, + } + if chainID != nil { + if !chainID.IsUint64() { + return nil, nil, errors.New("chain id overflows trezor message") + } + id := chainID.Uint64() + req.ChainId = &id + } + if to := tx.To(); to != nil { + addr := to.Hex() + req.To = &addr + } + return req, payload, nil + case types.AccessListTxType, types.DynamicFeeTxType, types.BlobTxType: + if chainID == nil { + return nil, nil, errors.New("typed transactions require a chain id") + } + if !chainID.IsUint64() { + return nil, nil, errors.New("chain id overflows trezor message") + } + id := chainID.Uint64() + req := &trezor.EthereumSignTxEIP1559{ + AddressN: derivationPath, + Nonce: encodeUint64(tx.Nonce()), + GasLimit: encodeUint64(tx.Gas()), + Value: bigIntBytes(tx.Value()), + DataLength: &length, + ChainId: &id, + AccessList: convertAccessListEIP1559(tx.AccessList()), + } + if to := tx.To(); to != nil { + addr := to.Hex() + req.To = &addr + } + switch tx.Type() { + case types.AccessListTxType: + price := bigIntBytes(tx.GasPrice()) + req.MaxGasFee = price + req.MaxPriorityFee = price + case types.DynamicFeeTxType: + req.MaxGasFee = bigIntBytes(tx.GasFeeCap()) + req.MaxPriorityFee = bigIntBytes(tx.GasTipCap()) + case types.BlobTxType: + req.MaxGasFee = bigIntBytes(tx.GasFeeCap()) + req.MaxPriorityFee = bigIntBytes(tx.GasTipCap()) + req.MaxFeePerBlobGas = bigIntBytes(tx.BlobGasFeeCap()) + req.BlobVersionedHashes = convertBlobHashes(tx.BlobHashes()) + } + return req, payload, nil + default: + return nil, nil, fmt.Errorf("unsupported transaction type %d", tx.Type()) + } +} + +func encodeUint64(value uint64) []byte { + if value == 0 { + return nil + } + return new(big.Int).SetUint64(value).Bytes() +} + +func bigIntBytes(v *big.Int) []byte { + if v == nil || v.Sign() == 0 { + return nil + } + return new(big.Int).Set(v).Bytes() +} + +func convertAccessListEIP1559(list types.AccessList) []*trezor.EthereumSignTxEIP1559_EthereumAccessList { + if len(list) == 0 { + return nil + } + out := make([]*trezor.EthereumSignTxEIP1559_EthereumAccessList, len(list)) + for i, entry := range list { + addr := entry.Address.Hex() + addrCopy := addr + keys := make([][]byte, len(entry.StorageKeys)) + for j, key := range entry.StorageKeys { + keys[j] = append([]byte{}, key[:]...) + } + out[i] = &trezor.EthereumSignTxEIP1559_EthereumAccessList{ + Address: &addrCopy, + StorageKeys: keys, + } + } + return out +} + +func convertBlobHashes(hashes []common.Hash) [][]byte { + if len(hashes) == 0 { + return nil + } + out := make([][]byte, len(hashes)) + for i, h := range hashes { + out[i] = append([]byte{}, h[:]...) + } + return out +} + +func setInitialChunk(msg proto.Message, chunk []byte) { + switch req := msg.(type) { + case *trezor.EthereumSignTx: + req.DataInitialChunk = chunk + case *trezor.EthereumSignTxEIP1559: + req.DataInitialChunk = chunk + } +} + // trezorExchange performs a data exchange with the Trezor wallet, sending it a // message and retrieving the response. If multiple responses are possible, the // method will also return the index of the destination object used. diff --git a/accounts/usbwallet/trezor/messages-ethereum.pb.go b/accounts/usbwallet/trezor/messages-ethereum.pb.go index a92123efcdda..30b395d7b8ba 100644 --- a/accounts/usbwallet/trezor/messages-ethereum.pb.go +++ b/accounts/usbwallet/trezor/messages-ethereum.pb.go @@ -1,11 +1,7 @@ -// This file originates from the SatoshiLabs Trezor `common` repository at: -// https://github.com/trezor/trezor-common/blob/master/protob/messages-ethereum.proto -// dated 28.05.2019, commit 893fd219d4a01bcffa0cd9cfa631856371ec5aa9. - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.1 +// protoc-gen-go v1.36.10 +// protoc v6.33.0 // source: messages-ethereum.proto package trezor @@ -15,6 +11,7 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -25,37 +22,36 @@ const ( ) // * -// Request: Ask device for public key corresponding to address_n path +// Request: Ask device for Ethereum address corresponding to address_n path // @start -// @next EthereumPublicKey +// @next EthereumAddress // @next Failure -type EthereumGetPublicKey struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"` // BIP-32 path to derive the key from master node - ShowDisplay *bool `protobuf:"varint,2,opt,name=show_display,json=showDisplay" json:"show_display,omitempty"` // optionally show on display before sending the result +type EthereumGetAddress struct { + state protoimpl.MessageState `protogen:"open.v1"` + AddressN []uint32 `protobuf:"varint,1,rep,packed,name=address_n,json=addressN,proto3" json:"address_n,omitempty"` // BIP-32 path to derive the key from master node + ShowDisplay *bool `protobuf:"varint,2,opt,name=show_display,json=showDisplay,proto3,oneof" json:"show_display,omitempty"` // optionally show on display before sending the result + EncodedNetwork *bool `protobuf:"varint,3,opt,name=encoded_network,json=encodedNetwork,proto3,oneof" json:"encoded_network,omitempty"` // encoded Ethereum network + Chunkify *bool `protobuf:"varint,4,opt,name=chunkify,proto3,oneof" json:"chunkify,omitempty"` // display the address in chunks of 4 characters + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *EthereumGetPublicKey) Reset() { - *x = EthereumGetPublicKey{} - if protoimpl.UnsafeEnabled { - mi := &file_messages_ethereum_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +func (x *EthereumGetAddress) Reset() { + *x = EthereumGetAddress{} + mi := &file_messages_ethereum_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *EthereumGetPublicKey) String() string { +func (x *EthereumGetAddress) String() string { return protoimpl.X.MessageStringOf(x) } -func (*EthereumGetPublicKey) ProtoMessage() {} +func (*EthereumGetAddress) ProtoMessage() {} -func (x *EthereumGetPublicKey) ProtoReflect() protoreflect.Message { +func (x *EthereumGetAddress) ProtoReflect() protoreflect.Message { mi := &file_messages_ethereum_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -65,55 +61,65 @@ func (x *EthereumGetPublicKey) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use EthereumGetPublicKey.ProtoReflect.Descriptor instead. -func (*EthereumGetPublicKey) Descriptor() ([]byte, []int) { +// Deprecated: Use EthereumGetAddress.ProtoReflect.Descriptor instead. +func (*EthereumGetAddress) Descriptor() ([]byte, []int) { return file_messages_ethereum_proto_rawDescGZIP(), []int{0} } -func (x *EthereumGetPublicKey) GetAddressN() []uint32 { +func (x *EthereumGetAddress) GetAddressN() []uint32 { if x != nil { return x.AddressN } return nil } -func (x *EthereumGetPublicKey) GetShowDisplay() bool { +func (x *EthereumGetAddress) GetShowDisplay() bool { if x != nil && x.ShowDisplay != nil { return *x.ShowDisplay } return false } +func (x *EthereumGetAddress) GetEncodedNetwork() bool { + if x != nil && x.EncodedNetwork != nil { + return *x.EncodedNetwork + } + return false +} + +func (x *EthereumGetAddress) GetChunkify() bool { + if x != nil && x.Chunkify != nil { + return *x.Chunkify + } + return false +} + // * -// Response: Contains public key derived from device private seed +// Response: Contains an Ethereum address derived from device private seed // @end -type EthereumPublicKey struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache +type EthereumAddress struct { + state protoimpl.MessageState `protogen:"open.v1"` + Address *string `protobuf:"bytes,2,opt,name=address,proto3,oneof" json:"address,omitempty"` // Ethereum address as hex-encoded string unknownFields protoimpl.UnknownFields - - Node *HDNodeType `protobuf:"bytes,1,opt,name=node" json:"node,omitempty"` // BIP32 public node - Xpub *string `protobuf:"bytes,2,opt,name=xpub" json:"xpub,omitempty"` // serialized form of public node + sizeCache protoimpl.SizeCache } -func (x *EthereumPublicKey) Reset() { - *x = EthereumPublicKey{} - if protoimpl.UnsafeEnabled { - mi := &file_messages_ethereum_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +func (x *EthereumAddress) Reset() { + *x = EthereumAddress{} + mi := &file_messages_ethereum_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *EthereumPublicKey) String() string { +func (x *EthereumAddress) String() string { return protoimpl.X.MessageStringOf(x) } -func (*EthereumPublicKey) ProtoMessage() {} +func (*EthereumAddress) ProtoMessage() {} -func (x *EthereumPublicKey) ProtoReflect() protoreflect.Message { +func (x *EthereumAddress) ProtoReflect() protoreflect.Message { mi := &file_messages_ethereum_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -123,57 +129,56 @@ func (x *EthereumPublicKey) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use EthereumPublicKey.ProtoReflect.Descriptor instead. -func (*EthereumPublicKey) Descriptor() ([]byte, []int) { +// Deprecated: Use EthereumAddress.ProtoReflect.Descriptor instead. +func (*EthereumAddress) Descriptor() ([]byte, []int) { return file_messages_ethereum_proto_rawDescGZIP(), []int{1} } -func (x *EthereumPublicKey) GetNode() *HDNodeType { - if x != nil { - return x.Node - } - return nil -} - -func (x *EthereumPublicKey) GetXpub() string { - if x != nil && x.Xpub != nil { - return *x.Xpub +func (x *EthereumAddress) GetAddress() string { + if x != nil && x.Address != nil { + return *x.Address } return "" } // * -// Request: Ask device for Ethereum address corresponding to address_n path +// Request: Ask device to sign legacy transaction // @start -// @next EthereumAddress +// @next EthereumTxRequest // @next Failure -type EthereumGetAddress struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"` // BIP-32 path to derive the key from master node - ShowDisplay *bool `protobuf:"varint,2,opt,name=show_display,json=showDisplay" json:"show_display,omitempty"` // optionally show on display before sending the result +type EthereumSignTx struct { + state protoimpl.MessageState `protogen:"open.v1"` + AddressN []uint32 `protobuf:"varint,1,rep,packed,name=address_n,json=addressN,proto3" json:"address_n,omitempty"` // BIP-32 path to derive the key from master node + Nonce []byte `protobuf:"bytes,2,opt,name=nonce,proto3,oneof" json:"nonce,omitempty"` // <=256 bit unsigned big endian + GasPrice []byte `protobuf:"bytes,3,opt,name=gas_price,json=gasPrice,proto3,oneof" json:"gas_price,omitempty"` // <=256 bit unsigned big endian (in wei) + GasLimit []byte `protobuf:"bytes,4,opt,name=gas_limit,json=gasLimit,proto3,oneof" json:"gas_limit,omitempty"` // <=256 bit unsigned big endian + To *string `protobuf:"bytes,11,opt,name=to,proto3,oneof" json:"to,omitempty"` // recipient address + Value []byte `protobuf:"bytes,6,opt,name=value,proto3,oneof" json:"value,omitempty"` // <=256 bit unsigned big endian (in wei) + DataInitialChunk []byte `protobuf:"bytes,7,opt,name=data_initial_chunk,json=dataInitialChunk,proto3,oneof" json:"data_initial_chunk,omitempty"` // The initial data chunk (<= 1024 bytes) + DataLength *uint32 `protobuf:"varint,8,opt,name=data_length,json=dataLength,proto3,oneof" json:"data_length,omitempty"` // Length of transaction payload + ChainId *uint64 `protobuf:"varint,9,opt,name=chain_id,json=chainId,proto3,oneof" json:"chain_id,omitempty"` // Chain Id for EIP 155 + TxType *uint32 `protobuf:"varint,10,opt,name=tx_type,json=txType,proto3,oneof" json:"tx_type,omitempty"` // transaction type + Chunkify *bool `protobuf:"varint,13,opt,name=chunkify,proto3,oneof" json:"chunkify,omitempty"` // display the address in chunks of 4 characters + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *EthereumGetAddress) Reset() { - *x = EthereumGetAddress{} - if protoimpl.UnsafeEnabled { - mi := &file_messages_ethereum_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +func (x *EthereumSignTx) Reset() { + *x = EthereumSignTx{} + mi := &file_messages_ethereum_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *EthereumGetAddress) String() string { +func (x *EthereumSignTx) String() string { return protoimpl.X.MessageStringOf(x) } -func (*EthereumGetAddress) ProtoMessage() {} +func (*EthereumSignTx) ProtoMessage() {} -func (x *EthereumGetAddress) ProtoReflect() protoreflect.Message { +func (x *EthereumSignTx) ProtoReflect() protoreflect.Message { mi := &file_messages_ethereum_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -183,126 +188,129 @@ func (x *EthereumGetAddress) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use EthereumGetAddress.ProtoReflect.Descriptor instead. -func (*EthereumGetAddress) Descriptor() ([]byte, []int) { +// Deprecated: Use EthereumSignTx.ProtoReflect.Descriptor instead. +func (*EthereumSignTx) Descriptor() ([]byte, []int) { return file_messages_ethereum_proto_rawDescGZIP(), []int{2} } -func (x *EthereumGetAddress) GetAddressN() []uint32 { +func (x *EthereumSignTx) GetAddressN() []uint32 { if x != nil { return x.AddressN } return nil } -func (x *EthereumGetAddress) GetShowDisplay() bool { - if x != nil && x.ShowDisplay != nil { - return *x.ShowDisplay +func (x *EthereumSignTx) GetNonce() []byte { + if x != nil { + return x.Nonce } - return false + return nil } -// * -// Response: Contains an Ethereum address derived from device private seed -// @end -type EthereumAddress struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +func (x *EthereumSignTx) GetGasPrice() []byte { + if x != nil { + return x.GasPrice + } + return nil +} - AddressBin []byte `protobuf:"bytes,1,opt,name=addressBin" json:"addressBin,omitempty"` // Ethereum address as 20 bytes (legacy firmwares) - AddressHex *string `protobuf:"bytes,2,opt,name=addressHex" json:"addressHex,omitempty"` // Ethereum address as hex string (newer firmwares) +func (x *EthereumSignTx) GetGasLimit() []byte { + if x != nil { + return x.GasLimit + } + return nil } -func (x *EthereumAddress) Reset() { - *x = EthereumAddress{} - if protoimpl.UnsafeEnabled { - mi := &file_messages_ethereum_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +func (x *EthereumSignTx) GetTo() string { + if x != nil && x.To != nil { + return *x.To } + return "" } -func (x *EthereumAddress) String() string { - return protoimpl.X.MessageStringOf(x) +func (x *EthereumSignTx) GetValue() []byte { + if x != nil { + return x.Value + } + return nil } -func (*EthereumAddress) ProtoMessage() {} +func (x *EthereumSignTx) GetDataInitialChunk() []byte { + if x != nil { + return x.DataInitialChunk + } + return nil +} -func (x *EthereumAddress) ProtoReflect() protoreflect.Message { - mi := &file_messages_ethereum_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (x *EthereumSignTx) GetDataLength() uint32 { + if x != nil && x.DataLength != nil { + return *x.DataLength } - return mi.MessageOf(x) + return 0 } -// Deprecated: Use EthereumAddress.ProtoReflect.Descriptor instead. -func (*EthereumAddress) Descriptor() ([]byte, []int) { - return file_messages_ethereum_proto_rawDescGZIP(), []int{3} +func (x *EthereumSignTx) GetChainId() uint64 { + if x != nil && x.ChainId != nil { + return *x.ChainId + } + return 0 } -func (x *EthereumAddress) GetAddressBin() []byte { - if x != nil { - return x.AddressBin +func (x *EthereumSignTx) GetTxType() uint32 { + if x != nil && x.TxType != nil { + return *x.TxType } - return nil + return 0 } -func (x *EthereumAddress) GetAddressHex() string { - if x != nil && x.AddressHex != nil { - return *x.AddressHex +func (x *EthereumSignTx) GetChunkify() bool { + if x != nil && x.Chunkify != nil { + return *x.Chunkify } - return "" + return false } // * -// Request: Ask device to sign transaction -// All fields are optional from the protocol's point of view. Each field defaults to value `0` if missing. -// Note: the first at most 1024 bytes of data MUST be transmitted as part of this message. +// Request: Ask device to sign EIP1559 transaction // @start // @next EthereumTxRequest // @next Failure -type EthereumSignTx struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"` // BIP-32 path to derive the key from master node - Nonce []byte `protobuf:"bytes,2,opt,name=nonce" json:"nonce,omitempty"` // <=256 bit unsigned big endian - GasPrice []byte `protobuf:"bytes,3,opt,name=gas_price,json=gasPrice" json:"gas_price,omitempty"` // <=256 bit unsigned big endian (in wei) - GasLimit []byte `protobuf:"bytes,4,opt,name=gas_limit,json=gasLimit" json:"gas_limit,omitempty"` // <=256 bit unsigned big endian - ToBin []byte `protobuf:"bytes,5,opt,name=toBin" json:"toBin,omitempty"` // recipient address (20 bytes, legacy firmware) - ToHex *string `protobuf:"bytes,11,opt,name=toHex" json:"toHex,omitempty"` // recipient address (hex string, newer firmware) - Value []byte `protobuf:"bytes,6,opt,name=value" json:"value,omitempty"` // <=256 bit unsigned big endian (in wei) - DataInitialChunk []byte `protobuf:"bytes,7,opt,name=data_initial_chunk,json=dataInitialChunk" json:"data_initial_chunk,omitempty"` // The initial data chunk (<= 1024 bytes) - DataLength *uint32 `protobuf:"varint,8,opt,name=data_length,json=dataLength" json:"data_length,omitempty"` // Length of transaction payload - ChainId *uint32 `protobuf:"varint,9,opt,name=chain_id,json=chainId" json:"chain_id,omitempty"` // Chain Id for EIP 155 - TxType *uint32 `protobuf:"varint,10,opt,name=tx_type,json=txType" json:"tx_type,omitempty"` // (only for Wanchain) -} - -func (x *EthereumSignTx) Reset() { - *x = EthereumSignTx{} - if protoimpl.UnsafeEnabled { - mi := &file_messages_ethereum_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +type EthereumSignTxEIP1559 struct { + state protoimpl.MessageState `protogen:"open.v1"` + AddressN []uint32 `protobuf:"varint,1,rep,packed,name=address_n,json=addressN,proto3" json:"address_n,omitempty"` // BIP-32 path to derive the key from master node + Nonce []byte `protobuf:"bytes,2,opt,name=nonce,proto3,oneof" json:"nonce,omitempty"` // <=256 bit unsigned big endian + MaxGasFee []byte `protobuf:"bytes,3,opt,name=max_gas_fee,json=maxGasFee,proto3,oneof" json:"max_gas_fee,omitempty"` // <=256 bit unsigned big endian (in wei) + MaxPriorityFee []byte `protobuf:"bytes,4,opt,name=max_priority_fee,json=maxPriorityFee,proto3,oneof" json:"max_priority_fee,omitempty"` // <=256 bit unsigned big endian (in wei) + GasLimit []byte `protobuf:"bytes,5,opt,name=gas_limit,json=gasLimit,proto3,oneof" json:"gas_limit,omitempty"` // <=256 bit unsigned big endian + To *string `protobuf:"bytes,6,opt,name=to,proto3,oneof" json:"to,omitempty"` // recipient address + Value []byte `protobuf:"bytes,7,opt,name=value,proto3,oneof" json:"value,omitempty"` // <=256 bit unsigned big endian (in wei) + DataInitialChunk []byte `protobuf:"bytes,8,opt,name=data_initial_chunk,json=dataInitialChunk,proto3,oneof" json:"data_initial_chunk,omitempty"` // The initial data chunk (<= 1024 bytes) + DataLength *uint32 `protobuf:"varint,9,opt,name=data_length,json=dataLength,proto3,oneof" json:"data_length,omitempty"` // Length of transaction payload + ChainId *uint64 `protobuf:"varint,10,opt,name=chain_id,json=chainId,proto3,oneof" json:"chain_id,omitempty"` // Chain Id for EIP 155 + AccessList []*EthereumSignTxEIP1559_EthereumAccessList `protobuf:"bytes,11,rep,name=access_list,json=accessList,proto3" json:"access_list,omitempty"` // Access List + MaxFeePerBlobGas []byte `protobuf:"bytes,12,opt,name=max_fee_per_blob_gas,json=maxFeePerBlobGas,proto3,oneof" json:"max_fee_per_blob_gas,omitempty"` // <=256 bit unsigned big endian (in wei) - EIP-4844 + BlobVersionedHashes [][]byte `protobuf:"bytes,13,rep,name=blob_versioned_hashes,json=blobVersionedHashes,proto3" json:"blob_versioned_hashes,omitempty"` // array of 32-byte hashes - EIP-4844 + Chunkify *bool `protobuf:"varint,14,opt,name=chunkify,proto3,oneof" json:"chunkify,omitempty"` // display the address in chunks of 4 characters + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EthereumSignTxEIP1559) Reset() { + *x = EthereumSignTxEIP1559{} + mi := &file_messages_ethereum_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *EthereumSignTx) String() string { +func (x *EthereumSignTxEIP1559) String() string { return protoimpl.X.MessageStringOf(x) } -func (*EthereumSignTx) ProtoMessage() {} +func (*EthereumSignTxEIP1559) ProtoMessage() {} -func (x *EthereumSignTx) ProtoReflect() protoreflect.Message { - mi := &file_messages_ethereum_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { +func (x *EthereumSignTxEIP1559) ProtoReflect() protoreflect.Message { + mi := &file_messages_ethereum_proto_msgTypes[3] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -312,112 +320,128 @@ func (x *EthereumSignTx) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use EthereumSignTx.ProtoReflect.Descriptor instead. -func (*EthereumSignTx) Descriptor() ([]byte, []int) { - return file_messages_ethereum_proto_rawDescGZIP(), []int{4} +// Deprecated: Use EthereumSignTxEIP1559.ProtoReflect.Descriptor instead. +func (*EthereumSignTxEIP1559) Descriptor() ([]byte, []int) { + return file_messages_ethereum_proto_rawDescGZIP(), []int{3} } -func (x *EthereumSignTx) GetAddressN() []uint32 { +func (x *EthereumSignTxEIP1559) GetAddressN() []uint32 { if x != nil { return x.AddressN } return nil } -func (x *EthereumSignTx) GetNonce() []byte { +func (x *EthereumSignTxEIP1559) GetNonce() []byte { if x != nil { return x.Nonce } return nil } -func (x *EthereumSignTx) GetGasPrice() []byte { +func (x *EthereumSignTxEIP1559) GetMaxGasFee() []byte { if x != nil { - return x.GasPrice + return x.MaxGasFee } return nil } -func (x *EthereumSignTx) GetGasLimit() []byte { +func (x *EthereumSignTxEIP1559) GetMaxPriorityFee() []byte { if x != nil { - return x.GasLimit + return x.MaxPriorityFee } return nil } -func (x *EthereumSignTx) GetToBin() []byte { +func (x *EthereumSignTxEIP1559) GetGasLimit() []byte { if x != nil { - return x.ToBin + return x.GasLimit } return nil } -func (x *EthereumSignTx) GetToHex() string { - if x != nil && x.ToHex != nil { - return *x.ToHex +func (x *EthereumSignTxEIP1559) GetTo() string { + if x != nil && x.To != nil { + return *x.To } return "" } -func (x *EthereumSignTx) GetValue() []byte { +func (x *EthereumSignTxEIP1559) GetValue() []byte { if x != nil { return x.Value } return nil } -func (x *EthereumSignTx) GetDataInitialChunk() []byte { +func (x *EthereumSignTxEIP1559) GetDataInitialChunk() []byte { if x != nil { return x.DataInitialChunk } return nil } -func (x *EthereumSignTx) GetDataLength() uint32 { +func (x *EthereumSignTxEIP1559) GetDataLength() uint32 { if x != nil && x.DataLength != nil { return *x.DataLength } return 0 } -func (x *EthereumSignTx) GetChainId() uint32 { +func (x *EthereumSignTxEIP1559) GetChainId() uint64 { if x != nil && x.ChainId != nil { return *x.ChainId } return 0 } -func (x *EthereumSignTx) GetTxType() uint32 { - if x != nil && x.TxType != nil { - return *x.TxType +func (x *EthereumSignTxEIP1559) GetAccessList() []*EthereumSignTxEIP1559_EthereumAccessList { + if x != nil { + return x.AccessList } - return 0 + return nil +} + +func (x *EthereumSignTxEIP1559) GetMaxFeePerBlobGas() []byte { + if x != nil { + return x.MaxFeePerBlobGas + } + return nil +} + +func (x *EthereumSignTxEIP1559) GetBlobVersionedHashes() [][]byte { + if x != nil { + return x.BlobVersionedHashes + } + return nil +} + +func (x *EthereumSignTxEIP1559) GetChunkify() bool { + if x != nil && x.Chunkify != nil { + return *x.Chunkify + } + return false } // * // Response: Device asks for more data from transaction payload, or returns the signature. -// If data_length is set, device awaits that many more bytes of payload. -// Otherwise, the signature_* fields contain the computed transaction signature. All three fields will be present. // @end // @next EthereumTxAck type EthereumTxRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + DataLength *uint32 `protobuf:"varint,1,opt,name=data_length,json=dataLength,proto3,oneof" json:"data_length,omitempty"` // Number of bytes being requested (<= 1024) + SignatureV *uint32 `protobuf:"varint,2,opt,name=signature_v,json=signatureV,proto3,oneof" json:"signature_v,omitempty"` // Computed signature (recovery parameter, limited to 27 or 28) + SignatureR []byte `protobuf:"bytes,3,opt,name=signature_r,json=signatureR,proto3,oneof" json:"signature_r,omitempty"` // Computed signature R component (256 bit) + SignatureS []byte `protobuf:"bytes,4,opt,name=signature_s,json=signatureS,proto3,oneof" json:"signature_s,omitempty"` // Computed signature S component (256 bit) unknownFields protoimpl.UnknownFields - - DataLength *uint32 `protobuf:"varint,1,opt,name=data_length,json=dataLength" json:"data_length,omitempty"` // Number of bytes being requested (<= 1024) - SignatureV *uint32 `protobuf:"varint,2,opt,name=signature_v,json=signatureV" json:"signature_v,omitempty"` // Computed signature (recovery parameter, limited to 27 or 28) - SignatureR []byte `protobuf:"bytes,3,opt,name=signature_r,json=signatureR" json:"signature_r,omitempty"` // Computed signature R component (256 bit) - SignatureS []byte `protobuf:"bytes,4,opt,name=signature_s,json=signatureS" json:"signature_s,omitempty"` // Computed signature S component (256 bit) + sizeCache protoimpl.SizeCache } func (x *EthereumTxRequest) Reset() { *x = EthereumTxRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_messages_ethereum_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_messages_ethereum_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EthereumTxRequest) String() string { @@ -427,8 +451,8 @@ func (x *EthereumTxRequest) String() string { func (*EthereumTxRequest) ProtoMessage() {} func (x *EthereumTxRequest) ProtoReflect() protoreflect.Message { - mi := &file_messages_ethereum_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_messages_ethereum_proto_msgTypes[4] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -440,7 +464,7 @@ func (x *EthereumTxRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use EthereumTxRequest.ProtoReflect.Descriptor instead. func (*EthereumTxRequest) Descriptor() ([]byte, []int) { - return file_messages_ethereum_proto_rawDescGZIP(), []int{5} + return file_messages_ethereum_proto_rawDescGZIP(), []int{4} } func (x *EthereumTxRequest) GetDataLength() uint32 { @@ -475,20 +499,17 @@ func (x *EthereumTxRequest) GetSignatureS() []byte { // Request: Transaction payload data. // @next EthereumTxRequest type EthereumTxAck struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + DataChunk []byte `protobuf:"bytes,1,opt,name=data_chunk,json=dataChunk,proto3,oneof" json:"data_chunk,omitempty"` // Bytes from transaction payload (<= 1024 bytes) unknownFields protoimpl.UnknownFields - - DataChunk []byte `protobuf:"bytes,1,opt,name=data_chunk,json=dataChunk" json:"data_chunk,omitempty"` // Bytes from transaction payload (<= 1024 bytes) + sizeCache protoimpl.SizeCache } func (x *EthereumTxAck) Reset() { *x = EthereumTxAck{} - if protoimpl.UnsafeEnabled { - mi := &file_messages_ethereum_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_messages_ethereum_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EthereumTxAck) String() string { @@ -498,8 +519,8 @@ func (x *EthereumTxAck) String() string { func (*EthereumTxAck) ProtoMessage() {} func (x *EthereumTxAck) ProtoReflect() protoreflect.Message { - mi := &file_messages_ethereum_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_messages_ethereum_proto_msgTypes[5] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -511,7 +532,7 @@ func (x *EthereumTxAck) ProtoReflect() protoreflect.Message { // Deprecated: Use EthereumTxAck.ProtoReflect.Descriptor instead. func (*EthereumTxAck) Descriptor() ([]byte, []int) { - return file_messages_ethereum_proto_rawDescGZIP(), []int{6} + return file_messages_ethereum_proto_rawDescGZIP(), []int{5} } func (x *EthereumTxAck) GetDataChunk() []byte { @@ -527,21 +548,20 @@ func (x *EthereumTxAck) GetDataChunk() []byte { // @next EthereumMessageSignature // @next Failure type EthereumSignMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"` // BIP-32 path to derive the key from master node - Message []byte `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` // message to be signed + state protoimpl.MessageState `protogen:"open.v1"` + AddressN []uint32 `protobuf:"varint,1,rep,packed,name=address_n,json=addressN,proto3" json:"address_n,omitempty"` // BIP-32 path to derive the key from master node + Message []byte `protobuf:"bytes,2,opt,name=message,proto3,oneof" json:"message,omitempty"` // message to be signed + EncodedNetwork *bool `protobuf:"varint,3,opt,name=encoded_network,json=encodedNetwork,proto3,oneof" json:"encoded_network,omitempty"` // encoded Ethereum network + Chunkify *bool `protobuf:"varint,4,opt,name=chunkify,proto3,oneof" json:"chunkify,omitempty"` // display the address in chunks of 4 characters + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *EthereumSignMessage) Reset() { *x = EthereumSignMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_messages_ethereum_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_messages_ethereum_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EthereumSignMessage) String() string { @@ -551,8 +571,8 @@ func (x *EthereumSignMessage) String() string { func (*EthereumSignMessage) ProtoMessage() {} func (x *EthereumSignMessage) ProtoReflect() protoreflect.Message { - mi := &file_messages_ethereum_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_messages_ethereum_proto_msgTypes[6] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -564,7 +584,7 @@ func (x *EthereumSignMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use EthereumSignMessage.ProtoReflect.Descriptor instead. func (*EthereumSignMessage) Descriptor() ([]byte, []int) { - return file_messages_ethereum_proto_rawDescGZIP(), []int{7} + return file_messages_ethereum_proto_rawDescGZIP(), []int{6} } func (x *EthereumSignMessage) GetAddressN() []uint32 { @@ -581,26 +601,36 @@ func (x *EthereumSignMessage) GetMessage() []byte { return nil } +func (x *EthereumSignMessage) GetEncodedNetwork() bool { + if x != nil && x.EncodedNetwork != nil { + return *x.EncodedNetwork + } + return false +} + +func (x *EthereumSignMessage) GetChunkify() bool { + if x != nil && x.Chunkify != nil { + return *x.Chunkify + } + return false +} + // * // Response: Signed message // @end type EthereumMessageSignature struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3,oneof" json:"signature,omitempty"` // signature of the message + Address *string `protobuf:"bytes,3,opt,name=address,proto3,oneof" json:"address,omitempty"` // address used to sign the message unknownFields protoimpl.UnknownFields - - AddressBin []byte `protobuf:"bytes,1,opt,name=addressBin" json:"addressBin,omitempty"` // address used to sign the message (20 bytes, legacy firmware) - Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` // signature of the message - AddressHex *string `protobuf:"bytes,3,opt,name=addressHex" json:"addressHex,omitempty"` // address used to sign the message (hex string, newer firmware) + sizeCache protoimpl.SizeCache } func (x *EthereumMessageSignature) Reset() { *x = EthereumMessageSignature{} - if protoimpl.UnsafeEnabled { - mi := &file_messages_ethereum_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_messages_ethereum_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EthereumMessageSignature) String() string { @@ -610,8 +640,8 @@ func (x *EthereumMessageSignature) String() string { func (*EthereumMessageSignature) ProtoMessage() {} func (x *EthereumMessageSignature) ProtoReflect() protoreflect.Message { - mi := &file_messages_ethereum_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_messages_ethereum_proto_msgTypes[7] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -623,14 +653,7 @@ func (x *EthereumMessageSignature) ProtoReflect() protoreflect.Message { // Deprecated: Use EthereumMessageSignature.ProtoReflect.Descriptor instead. func (*EthereumMessageSignature) Descriptor() ([]byte, []int) { - return file_messages_ethereum_proto_rawDescGZIP(), []int{8} -} - -func (x *EthereumMessageSignature) GetAddressBin() []byte { - if x != nil { - return x.AddressBin - } - return nil + return file_messages_ethereum_proto_rawDescGZIP(), []int{7} } func (x *EthereumMessageSignature) GetSignature() []byte { @@ -640,9 +663,9 @@ func (x *EthereumMessageSignature) GetSignature() []byte { return nil } -func (x *EthereumMessageSignature) GetAddressHex() string { - if x != nil && x.AddressHex != nil { - return *x.AddressHex +func (x *EthereumMessageSignature) GetAddress() string { + if x != nil && x.Address != nil { + return *x.Address } return "" } @@ -653,23 +676,20 @@ func (x *EthereumMessageSignature) GetAddressHex() string { // @next Success // @next Failure type EthereumVerifyMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3,oneof" json:"signature,omitempty"` // signature to verify + Message []byte `protobuf:"bytes,3,opt,name=message,proto3,oneof" json:"message,omitempty"` // message to verify + Address *string `protobuf:"bytes,4,opt,name=address,proto3,oneof" json:"address,omitempty"` // address to verify + Chunkify *bool `protobuf:"varint,5,opt,name=chunkify,proto3,oneof" json:"chunkify,omitempty"` // display the address in chunks of 4 characters unknownFields protoimpl.UnknownFields - - AddressBin []byte `protobuf:"bytes,1,opt,name=addressBin" json:"addressBin,omitempty"` // address to verify (20 bytes, legacy firmware) - Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` // signature to verify - Message []byte `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` // message to verify - AddressHex *string `protobuf:"bytes,4,opt,name=addressHex" json:"addressHex,omitempty"` // address to verify (hex string, newer firmware) + sizeCache protoimpl.SizeCache } func (x *EthereumVerifyMessage) Reset() { *x = EthereumVerifyMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_messages_ethereum_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_messages_ethereum_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EthereumVerifyMessage) String() string { @@ -679,8 +699,8 @@ func (x *EthereumVerifyMessage) String() string { func (*EthereumVerifyMessage) ProtoMessage() {} func (x *EthereumVerifyMessage) ProtoReflect() protoreflect.Message { - mi := &file_messages_ethereum_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_messages_ethereum_proto_msgTypes[8] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -692,160 +712,388 @@ func (x *EthereumVerifyMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use EthereumVerifyMessage.ProtoReflect.Descriptor instead. func (*EthereumVerifyMessage) Descriptor() ([]byte, []int) { + return file_messages_ethereum_proto_rawDescGZIP(), []int{8} +} + +func (x *EthereumVerifyMessage) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +func (x *EthereumVerifyMessage) GetMessage() []byte { + if x != nil { + return x.Message + } + return nil +} + +func (x *EthereumVerifyMessage) GetAddress() string { + if x != nil && x.Address != nil { + return *x.Address + } + return "" +} + +func (x *EthereumVerifyMessage) GetChunkify() bool { + if x != nil && x.Chunkify != nil { + return *x.Chunkify + } + return false +} + +// * +// Request: Ask device to sign hash of typed data (EIP-712) +// @start +// @next EthereumTypedDataSignature +// @next Failure +type EthereumSignTypedHash struct { + state protoimpl.MessageState `protogen:"open.v1"` + AddressN []uint32 `protobuf:"varint,1,rep,packed,name=address_n,json=addressN,proto3" json:"address_n,omitempty"` // BIP-32 path to derive the key from master node + DomainSeparatorHash []byte `protobuf:"bytes,2,opt,name=domain_separator_hash,json=domainSeparatorHash,proto3,oneof" json:"domain_separator_hash,omitempty"` // Hash of domainSeparator of typed data to be signed + MessageHash []byte `protobuf:"bytes,3,opt,name=message_hash,json=messageHash,proto3,oneof" json:"message_hash,omitempty"` // Hash of the data of typed data to be signed (empty if domain-only data) + EncodedNetwork *bool `protobuf:"varint,4,opt,name=encoded_network,json=encodedNetwork,proto3,oneof" json:"encoded_network,omitempty"` // encoded Ethereum network + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EthereumSignTypedHash) Reset() { + *x = EthereumSignTypedHash{} + mi := &file_messages_ethereum_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EthereumSignTypedHash) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EthereumSignTypedHash) ProtoMessage() {} + +func (x *EthereumSignTypedHash) ProtoReflect() protoreflect.Message { + mi := &file_messages_ethereum_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EthereumSignTypedHash.ProtoReflect.Descriptor instead. +func (*EthereumSignTypedHash) Descriptor() ([]byte, []int) { return file_messages_ethereum_proto_rawDescGZIP(), []int{9} } -func (x *EthereumVerifyMessage) GetAddressBin() []byte { +func (x *EthereumSignTypedHash) GetAddressN() []uint32 { if x != nil { - return x.AddressBin + return x.AddressN } return nil } -func (x *EthereumVerifyMessage) GetSignature() []byte { +func (x *EthereumSignTypedHash) GetDomainSeparatorHash() []byte { if x != nil { - return x.Signature + return x.DomainSeparatorHash } return nil } -func (x *EthereumVerifyMessage) GetMessage() []byte { +func (x *EthereumSignTypedHash) GetMessageHash() []byte { if x != nil { - return x.Message + return x.MessageHash + } + return nil +} + +func (x *EthereumSignTypedHash) GetEncodedNetwork() bool { + if x != nil && x.EncodedNetwork != nil { + return *x.EncodedNetwork + } + return false +} + +// * +// Response: Signed typed data +// @end +type EthereumTypedDataSignature struct { + state protoimpl.MessageState `protogen:"open.v1"` + Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3,oneof" json:"signature,omitempty"` // signature of the typed data + Address *string `protobuf:"bytes,2,opt,name=address,proto3,oneof" json:"address,omitempty"` // address used to sign the typed data + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EthereumTypedDataSignature) Reset() { + *x = EthereumTypedDataSignature{} + mi := &file_messages_ethereum_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EthereumTypedDataSignature) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EthereumTypedDataSignature) ProtoMessage() {} + +func (x *EthereumTypedDataSignature) ProtoReflect() protoreflect.Message { + mi := &file_messages_ethereum_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EthereumTypedDataSignature.ProtoReflect.Descriptor instead. +func (*EthereumTypedDataSignature) Descriptor() ([]byte, []int) { + return file_messages_ethereum_proto_rawDescGZIP(), []int{10} +} + +func (x *EthereumTypedDataSignature) GetSignature() []byte { + if x != nil { + return x.Signature } return nil } -func (x *EthereumVerifyMessage) GetAddressHex() string { - if x != nil && x.AddressHex != nil { - return *x.AddressHex +func (x *EthereumTypedDataSignature) GetAddress() string { + if x != nil && x.Address != nil { + return *x.Address } return "" } -var File_messages_ethereum_proto protoreflect.FileDescriptor +type EthereumSignTxEIP1559_EthereumAccessList struct { + state protoimpl.MessageState `protogen:"open.v1"` + Address *string `protobuf:"bytes,1,opt,name=address,proto3,oneof" json:"address,omitempty"` // address as hex string + StorageKeys [][]byte `protobuf:"bytes,2,rep,name=storage_keys,json=storageKeys,proto3" json:"storage_keys,omitempty"` // storage keys as 32-byte values + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} -var file_messages_ethereum_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2d, 0x65, 0x74, 0x68, 0x65, 0x72, - 0x65, 0x75, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 0x68, 0x77, 0x2e, 0x74, 0x72, - 0x65, 0x7a, 0x6f, 0x72, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x65, 0x74, - 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x1a, 0x15, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x56, 0x0a, - 0x14, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x47, 0x65, 0x74, 0x50, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x5f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x08, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x4e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x77, 0x5f, 0x64, 0x69, 0x73, 0x70, 0x6c, - 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x77, 0x44, 0x69, - 0x73, 0x70, 0x6c, 0x61, 0x79, 0x22, 0x62, 0x0a, 0x11, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, - 0x6d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x39, 0x0a, 0x04, 0x6e, 0x6f, - 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x68, 0x77, 0x2e, 0x74, 0x72, - 0x65, 0x7a, 0x6f, 0x72, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x48, 0x44, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x78, 0x70, 0x75, 0x62, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x78, 0x70, 0x75, 0x62, 0x22, 0x54, 0x0a, 0x12, 0x45, 0x74, 0x68, - 0x65, 0x72, 0x65, 0x75, 0x6d, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, - 0x1b, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x6e, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0d, 0x52, 0x08, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4e, 0x12, 0x21, 0x0a, 0x0c, - 0x73, 0x68, 0x6f, 0x77, 0x5f, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x77, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x22, - 0x51, 0x0a, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x69, 0x6e, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, - 0x69, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, 0x65, 0x78, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, - 0x65, 0x78, 0x22, 0xc2, 0x02, 0x0a, 0x0e, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x53, - 0x69, 0x67, 0x6e, 0x54, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x5f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x08, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x4e, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x67, 0x61, 0x73, 0x5f, - 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x67, 0x61, 0x73, - 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x67, 0x61, 0x73, 0x5f, 0x6c, 0x69, 0x6d, - 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x67, 0x61, 0x73, 0x4c, 0x69, 0x6d, - 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x42, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x05, 0x74, 0x6f, 0x42, 0x69, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x48, 0x65, - 0x78, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x48, 0x65, 0x78, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x69, 0x6e, 0x69, - 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x10, 0x64, 0x61, 0x74, 0x61, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x43, 0x68, 0x75, - 0x6e, 0x6b, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x4c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, - 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x17, - 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x06, 0x74, 0x78, 0x54, 0x79, 0x70, 0x65, 0x22, 0x97, 0x01, 0x0a, 0x11, 0x45, 0x74, 0x68, 0x65, - 0x72, 0x65, 0x75, 0x6d, 0x54, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, - 0x0b, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1f, - 0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x76, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x12, - 0x1f, 0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x72, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, - 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x53, 0x22, 0x2e, 0x0a, 0x0d, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x54, 0x78, 0x41, - 0x63, 0x6b, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x63, 0x68, 0x75, 0x6e, 0x6b, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x64, 0x61, 0x74, 0x61, 0x43, 0x68, 0x75, 0x6e, - 0x6b, 0x22, 0x4c, 0x0a, 0x13, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x53, 0x69, 0x67, - 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x5f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x08, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x4e, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, - 0x78, 0x0a, 0x18, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x0a, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x69, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x48, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, 0x65, 0x78, 0x22, 0x8f, 0x01, 0x0a, 0x15, 0x45, 0x74, - 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x69, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x42, 0x69, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, 0x65, 0x78, 0x42, 0x77, 0x0a, 0x23, 0x63, - 0x6f, 0x6d, 0x2e, 0x73, 0x61, 0x74, 0x6f, 0x73, 0x68, 0x69, 0x6c, 0x61, 0x62, 0x73, 0x2e, 0x74, - 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x2e, 0x6c, 0x69, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x42, 0x15, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2f, 0x67, - 0x6f, 0x2d, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x73, 0x2f, 0x75, 0x73, 0x62, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2f, 0x74, 0x72, - 0x65, 0x7a, 0x6f, 0x72, +func (x *EthereumSignTxEIP1559_EthereumAccessList) Reset() { + *x = EthereumSignTxEIP1559_EthereumAccessList{} + mi := &file_messages_ethereum_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EthereumSignTxEIP1559_EthereumAccessList) String() string { + return protoimpl.X.MessageStringOf(x) } +func (*EthereumSignTxEIP1559_EthereumAccessList) ProtoMessage() {} + +func (x *EthereumSignTxEIP1559_EthereumAccessList) ProtoReflect() protoreflect.Message { + mi := &file_messages_ethereum_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EthereumSignTxEIP1559_EthereumAccessList.ProtoReflect.Descriptor instead. +func (*EthereumSignTxEIP1559_EthereumAccessList) Descriptor() ([]byte, []int) { + return file_messages_ethereum_proto_rawDescGZIP(), []int{3, 0} +} + +func (x *EthereumSignTxEIP1559_EthereumAccessList) GetAddress() string { + if x != nil && x.Address != nil { + return *x.Address + } + return "" +} + +func (x *EthereumSignTxEIP1559_EthereumAccessList) GetStorageKeys() [][]byte { + if x != nil { + return x.StorageKeys + } + return nil +} + +var File_messages_ethereum_proto protoreflect.FileDescriptor + +const file_messages_ethereum_proto_rawDesc = "" + + "\n" + + "\x1cmessages-ethereum.proto\x12\x1bhw.trezor.messages.ethereum\"\xda\x01\n" + + "\x12EthereumGetAddress\x12\x1b\n" + + "\taddress_n\x18\x01 \x03(\rR\baddressN\x12&\n" + + "\fshow_display\x18\x02 \x01(\bH\x00R\vshowDisplay\x88\x01\x01\x12,\n" + + "\x0fencoded_network\x18\x03 \x01(\bH\x01R\x0eencodedNetwork\x88\x01\x01\x12\x1f\n" + + "\bchunkify\x18\x04 \x01(\bH\x02R\bchunkify\x88\x01\x01B\x0f\n" + + "\r_show_displayB\x12\n" + + "\x10_encoded_networkB\v\n" + + "\t_chunkify\"<\n" + + "\x0fEthereumAddress\x12\x1d\n" + + "\aaddress\x18\x02 \x01(\tH\x00R\aaddress\x88\x01\x01B\n" + + "\n" + + "\b_address\"\xf8\x03\n" + + "\x0eEthereumSignTx\x12\x1b\n" + + "\taddress_n\x18\x01 \x03(\rR\baddressN\x12\x19\n" + + "\x05nonce\x18\x02 \x01(\fH\x00R\x05nonce\x88\x01\x01\x12 \n" + + "\tgas_price\x18\x03 \x01(\fH\x01R\bgasPrice\x88\x01\x01\x12 \n" + + "\tgas_limit\x18\x04 \x01(\fH\x02R\bgasLimit\x88\x01\x01\x12\x13\n" + + "\x02to\x18\v \x01(\tH\x03R\x02to\x88\x01\x01\x12\x19\n" + + "\x05value\x18\x06 \x01(\fH\x04R\x05value\x88\x01\x01\x121\n" + + "\x12data_initial_chunk\x18\a \x01(\fH\x05R\x10dataInitialChunk\x88\x01\x01\x12$\n" + + "\vdata_length\x18\b \x01(\rH\x06R\n" + + "dataLength\x88\x01\x01\x12\x1e\n" + + "\bchain_id\x18\t \x01(\x04H\aR\achainId\x88\x01\x01\x12\x1c\n" + + "\atx_type\x18\n" + + " \x01(\rH\bR\x06txType\x88\x01\x01\x12\x1f\n" + + "\bchunkify\x18\r \x01(\bH\tR\bchunkify\x88\x01\x01B\b\n" + + "\x06_nonceB\f\n" + + "\n" + + "_gas_priceB\f\n" + + "\n" + + "_gas_limitB\x05\n" + + "\x03_toB\b\n" + + "\x06_valueB\x15\n" + + "\x13_data_initial_chunkB\x0e\n" + + "\f_data_lengthB\v\n" + + "\t_chain_idB\n" + + "\n" + + "\b_tx_typeB\v\n" + + "\t_chunkify\"\xec\x06\n" + + "\x15EthereumSignTxEIP1559\x12\x1b\n" + + "\taddress_n\x18\x01 \x03(\rR\baddressN\x12\x19\n" + + "\x05nonce\x18\x02 \x01(\fH\x00R\x05nonce\x88\x01\x01\x12#\n" + + "\vmax_gas_fee\x18\x03 \x01(\fH\x01R\tmaxGasFee\x88\x01\x01\x12-\n" + + "\x10max_priority_fee\x18\x04 \x01(\fH\x02R\x0emaxPriorityFee\x88\x01\x01\x12 \n" + + "\tgas_limit\x18\x05 \x01(\fH\x03R\bgasLimit\x88\x01\x01\x12\x13\n" + + "\x02to\x18\x06 \x01(\tH\x04R\x02to\x88\x01\x01\x12\x19\n" + + "\x05value\x18\a \x01(\fH\x05R\x05value\x88\x01\x01\x121\n" + + "\x12data_initial_chunk\x18\b \x01(\fH\x06R\x10dataInitialChunk\x88\x01\x01\x12$\n" + + "\vdata_length\x18\t \x01(\rH\aR\n" + + "dataLength\x88\x01\x01\x12\x1e\n" + + "\bchain_id\x18\n" + + " \x01(\x04H\bR\achainId\x88\x01\x01\x12f\n" + + "\vaccess_list\x18\v \x03(\v2E.hw.trezor.messages.ethereum.EthereumSignTxEIP1559.EthereumAccessListR\n" + + "accessList\x123\n" + + "\x14max_fee_per_blob_gas\x18\f \x01(\fH\tR\x10maxFeePerBlobGas\x88\x01\x01\x122\n" + + "\x15blob_versioned_hashes\x18\r \x03(\fR\x13blobVersionedHashes\x12\x1f\n" + + "\bchunkify\x18\x0e \x01(\bH\n" + + "R\bchunkify\x88\x01\x01\x1ab\n" + + "\x12EthereumAccessList\x12\x1d\n" + + "\aaddress\x18\x01 \x01(\tH\x00R\aaddress\x88\x01\x01\x12!\n" + + "\fstorage_keys\x18\x02 \x03(\fR\vstorageKeysB\n" + + "\n" + + "\b_addressB\b\n" + + "\x06_nonceB\x0e\n" + + "\f_max_gas_feeB\x13\n" + + "\x11_max_priority_feeB\f\n" + + "\n" + + "_gas_limitB\x05\n" + + "\x03_toB\b\n" + + "\x06_valueB\x15\n" + + "\x13_data_initial_chunkB\x0e\n" + + "\f_data_lengthB\v\n" + + "\t_chain_idB\x17\n" + + "\x15_max_fee_per_blob_gasB\v\n" + + "\t_chunkify\"\xeb\x01\n" + + "\x11EthereumTxRequest\x12$\n" + + "\vdata_length\x18\x01 \x01(\rH\x00R\n" + + "dataLength\x88\x01\x01\x12$\n" + + "\vsignature_v\x18\x02 \x01(\rH\x01R\n" + + "signatureV\x88\x01\x01\x12$\n" + + "\vsignature_r\x18\x03 \x01(\fH\x02R\n" + + "signatureR\x88\x01\x01\x12$\n" + + "\vsignature_s\x18\x04 \x01(\fH\x03R\n" + + "signatureS\x88\x01\x01B\x0e\n" + + "\f_data_lengthB\x0e\n" + + "\f_signature_vB\x0e\n" + + "\f_signature_rB\x0e\n" + + "\f_signature_s\"B\n" + + "\rEthereumTxAck\x12\"\n" + + "\n" + + "data_chunk\x18\x01 \x01(\fH\x00R\tdataChunk\x88\x01\x01B\r\n" + + "\v_data_chunk\"\xcd\x01\n" + + "\x13EthereumSignMessage\x12\x1b\n" + + "\taddress_n\x18\x01 \x03(\rR\baddressN\x12\x1d\n" + + "\amessage\x18\x02 \x01(\fH\x00R\amessage\x88\x01\x01\x12,\n" + + "\x0fencoded_network\x18\x03 \x01(\bH\x01R\x0eencodedNetwork\x88\x01\x01\x12\x1f\n" + + "\bchunkify\x18\x04 \x01(\bH\x02R\bchunkify\x88\x01\x01B\n" + + "\n" + + "\b_messageB\x12\n" + + "\x10_encoded_networkB\v\n" + + "\t_chunkify\"v\n" + + "\x18EthereumMessageSignature\x12!\n" + + "\tsignature\x18\x02 \x01(\fH\x00R\tsignature\x88\x01\x01\x12\x1d\n" + + "\aaddress\x18\x03 \x01(\tH\x01R\aaddress\x88\x01\x01B\f\n" + + "\n" + + "_signatureB\n" + + "\n" + + "\b_address\"\xcc\x01\n" + + "\x15EthereumVerifyMessage\x12!\n" + + "\tsignature\x18\x02 \x01(\fH\x00R\tsignature\x88\x01\x01\x12\x1d\n" + + "\amessage\x18\x03 \x01(\fH\x01R\amessage\x88\x01\x01\x12\x1d\n" + + "\aaddress\x18\x04 \x01(\tH\x02R\aaddress\x88\x01\x01\x12\x1f\n" + + "\bchunkify\x18\x05 \x01(\bH\x03R\bchunkify\x88\x01\x01B\f\n" + + "\n" + + "_signatureB\n" + + "\n" + + "\b_messageB\n" + + "\n" + + "\b_addressB\v\n" + + "\t_chunkify\"\x82\x02\n" + + "\x15EthereumSignTypedHash\x12\x1b\n" + + "\taddress_n\x18\x01 \x03(\rR\baddressN\x127\n" + + "\x15domain_separator_hash\x18\x02 \x01(\fH\x00R\x13domainSeparatorHash\x88\x01\x01\x12&\n" + + "\fmessage_hash\x18\x03 \x01(\fH\x01R\vmessageHash\x88\x01\x01\x12,\n" + + "\x0fencoded_network\x18\x04 \x01(\bH\x02R\x0eencodedNetwork\x88\x01\x01B\x18\n" + + "\x16_domain_separator_hashB\x0f\n" + + "\r_message_hashB\x12\n" + + "\x10_encoded_network\"x\n" + + "\x1aEthereumTypedDataSignature\x12!\n" + + "\tsignature\x18\x01 \x01(\fH\x00R\tsignature\x88\x01\x01\x12\x1d\n" + + "\aaddress\x18\x02 \x01(\tH\x01R\aaddress\x88\x01\x01B\f\n" + + "\n" + + "_signatureB\n" + + "\n" + + "\b_addressB\n" + + "Z\b.;trezorb\x06proto3" + var ( file_messages_ethereum_proto_rawDescOnce sync.Once - file_messages_ethereum_proto_rawDescData = file_messages_ethereum_proto_rawDesc + file_messages_ethereum_proto_rawDescData []byte ) func file_messages_ethereum_proto_rawDescGZIP() []byte { file_messages_ethereum_proto_rawDescOnce.Do(func() { - file_messages_ethereum_proto_rawDescData = protoimpl.X.CompressGZIP(file_messages_ethereum_proto_rawDescData) + file_messages_ethereum_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_messages_ethereum_proto_rawDesc), len(file_messages_ethereum_proto_rawDesc))) }) return file_messages_ethereum_proto_rawDescData } -var file_messages_ethereum_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_messages_ethereum_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_messages_ethereum_proto_goTypes = []any{ - (*EthereumGetPublicKey)(nil), // 0: hw.trezor.messages.ethereum.EthereumGetPublicKey - (*EthereumPublicKey)(nil), // 1: hw.trezor.messages.ethereum.EthereumPublicKey - (*EthereumGetAddress)(nil), // 2: hw.trezor.messages.ethereum.EthereumGetAddress - (*EthereumAddress)(nil), // 3: hw.trezor.messages.ethereum.EthereumAddress - (*EthereumSignTx)(nil), // 4: hw.trezor.messages.ethereum.EthereumSignTx - (*EthereumTxRequest)(nil), // 5: hw.trezor.messages.ethereum.EthereumTxRequest - (*EthereumTxAck)(nil), // 6: hw.trezor.messages.ethereum.EthereumTxAck - (*EthereumSignMessage)(nil), // 7: hw.trezor.messages.ethereum.EthereumSignMessage - (*EthereumMessageSignature)(nil), // 8: hw.trezor.messages.ethereum.EthereumMessageSignature - (*EthereumVerifyMessage)(nil), // 9: hw.trezor.messages.ethereum.EthereumVerifyMessage - (*HDNodeType)(nil), // 10: hw.trezor.messages.common.HDNodeType + (*EthereumGetAddress)(nil), // 0: hw.trezor.messages.ethereum.EthereumGetAddress + (*EthereumAddress)(nil), // 1: hw.trezor.messages.ethereum.EthereumAddress + (*EthereumSignTx)(nil), // 2: hw.trezor.messages.ethereum.EthereumSignTx + (*EthereumSignTxEIP1559)(nil), // 3: hw.trezor.messages.ethereum.EthereumSignTxEIP1559 + (*EthereumTxRequest)(nil), // 4: hw.trezor.messages.ethereum.EthereumTxRequest + (*EthereumTxAck)(nil), // 5: hw.trezor.messages.ethereum.EthereumTxAck + (*EthereumSignMessage)(nil), // 6: hw.trezor.messages.ethereum.EthereumSignMessage + (*EthereumMessageSignature)(nil), // 7: hw.trezor.messages.ethereum.EthereumMessageSignature + (*EthereumVerifyMessage)(nil), // 8: hw.trezor.messages.ethereum.EthereumVerifyMessage + (*EthereumSignTypedHash)(nil), // 9: hw.trezor.messages.ethereum.EthereumSignTypedHash + (*EthereumTypedDataSignature)(nil), // 10: hw.trezor.messages.ethereum.EthereumTypedDataSignature + (*EthereumSignTxEIP1559_EthereumAccessList)(nil), // 11: hw.trezor.messages.ethereum.EthereumSignTxEIP1559.EthereumAccessList } var file_messages_ethereum_proto_depIdxs = []int32{ - 10, // 0: hw.trezor.messages.ethereum.EthereumPublicKey.node:type_name -> hw.trezor.messages.common.HDNodeType + 11, // 0: hw.trezor.messages.ethereum.EthereumSignTxEIP1559.access_list:type_name -> hw.trezor.messages.ethereum.EthereumSignTxEIP1559.EthereumAccessList 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name @@ -858,136 +1106,25 @@ func file_messages_ethereum_proto_init() { if File_messages_ethereum_proto != nil { return } - file_messages_common_proto_init() - if !protoimpl.UnsafeEnabled { - file_messages_ethereum_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*EthereumGetPublicKey); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_messages_ethereum_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*EthereumPublicKey); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_messages_ethereum_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*EthereumGetAddress); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_messages_ethereum_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*EthereumAddress); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_messages_ethereum_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*EthereumSignTx); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_messages_ethereum_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*EthereumTxRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_messages_ethereum_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*EthereumTxAck); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_messages_ethereum_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*EthereumSignMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_messages_ethereum_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*EthereumMessageSignature); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_messages_ethereum_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*EthereumVerifyMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } + file_messages_ethereum_proto_msgTypes[0].OneofWrappers = []any{} + file_messages_ethereum_proto_msgTypes[1].OneofWrappers = []any{} + file_messages_ethereum_proto_msgTypes[2].OneofWrappers = []any{} + file_messages_ethereum_proto_msgTypes[3].OneofWrappers = []any{} + file_messages_ethereum_proto_msgTypes[4].OneofWrappers = []any{} + file_messages_ethereum_proto_msgTypes[5].OneofWrappers = []any{} + file_messages_ethereum_proto_msgTypes[6].OneofWrappers = []any{} + file_messages_ethereum_proto_msgTypes[7].OneofWrappers = []any{} + file_messages_ethereum_proto_msgTypes[8].OneofWrappers = []any{} + file_messages_ethereum_proto_msgTypes[9].OneofWrappers = []any{} + file_messages_ethereum_proto_msgTypes[10].OneofWrappers = []any{} + file_messages_ethereum_proto_msgTypes[11].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_messages_ethereum_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_messages_ethereum_proto_rawDesc), len(file_messages_ethereum_proto_rawDesc)), NumEnums: 0, - NumMessages: 10, + NumMessages: 12, NumExtensions: 0, NumServices: 0, }, @@ -996,7 +1133,6 @@ func file_messages_ethereum_proto_init() { MessageInfos: file_messages_ethereum_proto_msgTypes, }.Build() File_messages_ethereum_proto = out.File - file_messages_ethereum_proto_rawDesc = nil file_messages_ethereum_proto_goTypes = nil file_messages_ethereum_proto_depIdxs = nil } diff --git a/accounts/usbwallet/trezor/messages-ethereum.proto b/accounts/usbwallet/trezor/messages-ethereum.proto index 8e1150abb6b6..9a4648bac7b4 100644 --- a/accounts/usbwallet/trezor/messages-ethereum.proto +++ b/accounts/usbwallet/trezor/messages-ethereum.proto @@ -1,18 +1,12 @@ -// This file originates from the SatoshiLabs Trezor `common` repository at: -// https://github.com/trezor/trezor-common/blob/master/protob/messages-ethereum.proto -// dated 28.05.2019, commit 893fd219d4a01bcffa0cd9cfa631856371ec5aa9. - syntax = "proto2"; package hw.trezor.messages.ethereum; -option go_package = "github.com/ethereum/go-ethereum/accounts/usbwallet/trezor"; - // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; option java_outer_classname = "TrezorMessageEthereum"; import "messages-common.proto"; - +import "options.proto"; /** * Request: Ask device for public key corresponding to address_n path @@ -21,8 +15,8 @@ import "messages-common.proto"; * @next Failure */ message EthereumGetPublicKey { - repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node - optional bool show_display = 2; // optionally show on display before sending the result + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node + optional bool show_display = 2; // optionally show on display before sending the result } /** @@ -30,8 +24,8 @@ message EthereumGetPublicKey { * @end */ message EthereumPublicKey { - optional hw.trezor.messages.common.HDNodeType node = 1; // BIP32 public node - optional string xpub = 2; // serialized form of public node + required hw.trezor.messages.common.HDNodeType node = 1; // BIP32 public node + required string xpub = 2; // serialized form of public node } /** @@ -41,8 +35,10 @@ message EthereumPublicKey { * @next Failure */ message EthereumGetAddress { - repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node - optional bool show_display = 2; // optionally show on display before sending the result + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node + optional bool show_display = 2; // optionally show on display before sending the result + optional bytes encoded_network = 3; // encoded Ethereum network, see external-definitions.md for details + optional bool chunkify = 4; // display the address in chunks of 4 characters } /** @@ -50,30 +46,63 @@ message EthereumGetAddress { * @end */ message EthereumAddress { - optional bytes addressBin = 1; // Ethereum address as 20 bytes (legacy firmwares) - optional string addressHex = 2; // Ethereum address as hex string (newer firmwares) + optional bytes _old_address = 1 [deprecated=true]; // trezor <1.8.0, <2.1.0 - raw bytes of Ethereum address + optional string address = 2; // Ethereum address as hex-encoded string + optional bytes mac = 3; // Address authentication code } /** * Request: Ask device to sign transaction - * All fields are optional from the protocol's point of view. Each field defaults to value `0` if missing. + * gas_price, gas_limit and chain_id must be provided and non-zero. + * All other fields are optional and default to value `0` if missing. * Note: the first at most 1024 bytes of data MUST be transmitted as part of this message. * @start * @next EthereumTxRequest * @next Failure */ message EthereumSignTx { - repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node - optional bytes nonce = 2; // <=256 bit unsigned big endian - optional bytes gas_price = 3; // <=256 bit unsigned big endian (in wei) - optional bytes gas_limit = 4; // <=256 bit unsigned big endian - optional bytes toBin = 5; // recipient address (20 bytes, legacy firmware) - optional string toHex = 11; // recipient address (hex string, newer firmware) - optional bytes value = 6; // <=256 bit unsigned big endian (in wei) - optional bytes data_initial_chunk = 7; // The initial data chunk (<= 1024 bytes) - optional uint32 data_length = 8; // Length of transaction payload - optional uint32 chain_id = 9; // Chain Id for EIP 155 - optional uint32 tx_type = 10; // (only for Wanchain) + 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 + optional common.PaymentRequest payment_req = 14 [(experimental_field)=true]; // SLIP-24 payment request +} + +/** + * Request: Ask device to sign EIP1559 transaction + * Note: the first at most 1024 bytes of data MUST be transmitted as part of this message. + * @start + * @next EthereumTxRequest + * @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 EthereumDefinitions definitions = 12; // network and/or token definitions for tx + optional bool chunkify = 13; // display the address in chunks of 4 characters + optional common.PaymentRequest payment_req = 14 [(experimental_field)=true]; // SLIP-24 payment request + + message EthereumAccessList { + required string address = 1; + repeated bytes storage_keys = 2; + } } /** @@ -95,7 +124,7 @@ message EthereumTxRequest { * @next EthereumTxRequest */ message EthereumTxAck { - optional bytes data_chunk = 1; // Bytes from transaction payload (<= 1024 bytes) + required bytes data_chunk = 1; // Bytes from transaction payload (<= 1024 bytes) } /** @@ -105,8 +134,10 @@ message EthereumTxAck { * @next Failure */ message EthereumSignMessage { - repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node - optional bytes message = 2; // message to be signed + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node + required bytes message = 2; // message to be signed + optional bytes encoded_network = 3; // encoded Ethereum network, see external-definitions.md for details + optional bool chunkify = 4; // display the address in chunks of 4 characters } /** @@ -114,9 +145,8 @@ message EthereumSignMessage { * @end */ message EthereumMessageSignature { - optional bytes addressBin = 1; // address used to sign the message (20 bytes, legacy firmware) - optional bytes signature = 2; // signature of the message - optional string addressHex = 3; // address used to sign the message (hex string, newer firmware) + required bytes signature = 2; // signature of the message + required string address = 3; // address used to sign the message } /** @@ -126,8 +156,39 @@ message EthereumMessageSignature { * @next Failure */ message EthereumVerifyMessage { - optional bytes addressBin = 1; // address to verify (20 bytes, legacy firmware) - optional bytes signature = 2; // signature to verify - optional bytes message = 3; // message to verify - optional string addressHex = 4; // address to verify (hex string, newer firmware) + required bytes signature = 2; // signature to verify + required bytes message = 3; // message to verify + required string address = 4; // address to verify + optional bool chunkify = 5; // display the address in chunks of 4 characters +} + +/** + * Request: Ask device to sign hash of typed data + * @start + * @next EthereumTypedDataSignature + * @next Failure + */ +message EthereumSignTypedHash { + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node + required bytes domain_separator_hash = 2; // Hash of domainSeparator of typed data to be signed + optional bytes message_hash = 3; // Hash of the data of typed data to be signed (empty if domain-only data) + optional bytes encoded_network = 4; // encoded Ethereum network, see external-definitions.md for details } + +/** + * Response: Signed typed data + * @end + */ +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 external-definitions.md for details. + * @embed + */ +message EthereumDefinitions { + optional bytes encoded_network = 1; // encoded ethereum network + optional bytes encoded_token = 2; // encoded ethereum token +} \ No newline at end of file