Skip to content

Commit 7fb9bd1

Browse files
author
Danny Diekroeger
committed
added utxo support - fixed order of logic
1 parent d1dd936 commit 7fb9bd1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

app/sign.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ const handleSignUtxo = function(recoveryRequest, key, skipConfirm) {
9090
throw new Error(`Unsupported coin: ${recoveryRequest.coin}`);
9191
}
9292

93-
const transaction = utxoLib.Transaction.fromHex(recoveryRequest.transactionHex, network);
93+
const txHex = getTransactionHexFromRequest(recoveryRequest);
94+
const transaction = utxoLib.Transaction.fromHex(txHex, network);
9495

9596
const outputs = transaction.outs.map(out => ({
9697
address: utxoLib.address.fromOutputScript(out.script, network),
@@ -337,15 +338,15 @@ const parseKey = function(rawkey, coin, path) {
337338
This function gets and gets and returns the transaction hex in all of these cases
338339
*/
339340
const getTransactionHexFromRequest = function(recoveryRequest) {
340-
if (recoveryRequest.tx){
341-
return recoveryRequest.tx
342-
}
343341
if (recoveryRequest.txHex){
344342
return recoveryRequest.txHex
345343
}
346344
if (recoveryRequest.transactionHex){
347345
return recoveryRequest.transactionHex
348346
}
347+
if (recoveryRequest.tx){
348+
return recoveryRequest.tx
349+
}
349350
throw new Error("The recovery request did not provide a transaction hex");
350351
}
351352

0 commit comments

Comments
 (0)