Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion api/firmware/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ func (device *Device) ETHSign(
}

// ETHSignEIP1559 signs an ethereum EIP1559 transaction. It returns a 65 byte signature (R, S, and 1 byte recID).
// If paymentRequest is provided, firmware v9.26.0 or newer is required.
func (device *Device) ETHSignEIP1559(
chainID uint64,
keypath []uint32,
Expand All @@ -221,11 +222,16 @@ func (device *Device) ETHSignEIP1559(
recipient [20]byte,
value *big.Int,
data []byte,
recipientAddressCase messages.ETHAddressCase) ([]byte, error) {
recipientAddressCase messages.ETHAddressCase,
paymentRequest *messages.BTCPaymentRequestRequest,
) ([]byte, error) {

if !device.version.AtLeast(semver.NewSemVer(9, 16, 0)) {
return nil, UnsupportedError("9.16.0")
}
if paymentRequest != nil && !device.version.AtLeast(semver.NewSemVer(9, 26, 0)) {
return nil, UnsupportedError("9.26.0")
}

hostNonceCommitment, hostNonce, err := handleHostNonceCommitment()
if err != nil {
Expand All @@ -246,6 +252,7 @@ func (device *Device) ETHSignEIP1559(
Data: data,
HostNonceCommitment: hostNonceCommitment,
AddressCase: recipientAddressCase,
PaymentRequest: paymentRequest,
},
},
}
Expand Down
1 change: 1 addition & 0 deletions api/firmware/eth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ func TestSimulatorETHSignEIP1559(t *testing.T) {
value,
nil,
messages.ETHAddressCase_ETH_ADDRESS_CASE_MIXED,
nil,
)
require.NoError(t, err)

Expand Down
363 changes: 301 additions & 62 deletions api/firmware/messages/btc.pb.go

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions api/firmware/messages/btc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,27 @@ message BTCPaymentRequestRequest {
message TextMemo {
string note = 1;
}
message CoinPurchaseMemo {
uint32 coin_type = 1; // SLIP-44 coin type
string amount = 2; // Human-readable amount (e.g. "0.25 ETH")
string address = 3; // Address to send the purchased coins to
// Derivation info for verifying address ownership.
// NOT part of the SLIP-24 sighash.
message EthAddressDerivation {
repeated uint32 keypath = 1; // Keypath to the address
}
message BtcAddressDerivation {
// Script config + keypath are needed to derive BTC/LTC-family addresses.
BTCScriptConfigWithKeypath script_config = 1;
}
oneof address_derivation {
EthAddressDerivation eth = 4;
BtcAddressDerivation btc = 5;
}
}
oneof memo {
TextMemo text_memo = 1;
CoinPurchaseMemo coin_purchase_memo = 2;
}
}

Expand Down
Loading
Loading