File tree Expand file tree Collapse file tree 6 files changed +822
-316
lines changed Expand file tree Collapse file tree 6 files changed +822
-316
lines changed Original file line number Diff line number Diff line change @@ -232,10 +232,11 @@ type BTCTxInput struct {
232
232
233
233
// BTCTx is the data needed to sign a btc transaction.
234
234
type BTCTx struct {
235
- Version uint32
236
- Inputs []* BTCTxInput
237
- Outputs []* messages.BTCSignOutputRequest
238
- Locktime uint32
235
+ Version uint32
236
+ Inputs []* BTCTxInput
237
+ Outputs []* messages.BTCSignOutputRequest
238
+ Locktime uint32
239
+ PaymentRequests []* messages.BTCPaymentRequestRequest
239
240
}
240
241
241
242
// BTCSign signs a bitcoin or bitcoin-like transaction. The previous transactions of the inputs
@@ -387,6 +388,22 @@ func (device *Device) BTCSign(
387
388
if err != nil {
388
389
return nil , err
389
390
}
391
+ case messages .BTCSignNextResponse_PAYMENT_REQUEST :
392
+ paymentRequestIndex := next .Index
393
+ if int (paymentRequestIndex ) >= len (tx .PaymentRequests ) {
394
+ return nil , errp .New ("payment request index out of bounds" )
395
+ }
396
+ paymentRequest := tx .PaymentRequests [paymentRequestIndex ]
397
+ next , err = device .nestedQueryBtcSign (
398
+ & messages.BTCRequest {
399
+ Request : & messages.BTCRequest_PaymentRequest {
400
+ PaymentRequest : paymentRequest ,
401
+ },
402
+ },
403
+ )
404
+ if err != nil {
405
+ return nil , err
406
+ }
390
407
case messages .BTCSignNextResponse_DONE :
391
408
return signatures , nil
392
409
}
You can’t perform that action at this time.
0 commit comments