@@ -101,12 +101,12 @@ const getHDNodeAndVerify = function(xprv, expectedXpub) {
101
101
/**
102
102
* Prints the recovery transaction information and prompt for the confirmation as well as the key, if needed to.
103
103
* @param recoveryRequest The recovery transansaction request object.
104
- * @param key The provided private key of the wallet.
105
104
* @param outputs The outputs of the transaction.
106
105
* @param skipConfirm The boolean value that indicates to whether or not to prompt the user to confirm the transaction.
106
+ * @param [key] The provided private key of the wallet.
107
107
* @returns The private key of the wallet.
108
108
*/
109
- const promptForConfirmatioAndKey = function ( recoveryRequest , key , outputs , skipConfirm ) {
109
+ const promptForConfirmationAndKey = function ( recoveryRequest , outputs , skipConfirm , key ) {
110
110
const customMessage = recoveryRequest . custom ? recoveryRequest . custom . message : 'None' ;
111
111
confirmRecovery ( recoveryRequest . backupKey , outputs , customMessage , skipConfirm ) ;
112
112
@@ -146,7 +146,7 @@ const handleSignUtxo = function(recoveryRequest, key, skipConfirm) {
146
146
amount : ( new BN ( out . value ) ) . div ( TEN . pow ( decimals ) ) . toString ( )
147
147
} ) ) ;
148
148
149
- key = promptForConfirmatioAndKey ( recoveryRequest , key , outputs , skipConfirm ) ;
149
+ key = promptForConfirmationAndKey ( recoveryRequest , outputs , skipConfirm , key ) ;
150
150
151
151
const backupKeyNode = getHDNodeAndVerify ( key , recoveryRequest . backupKey ) ;
152
152
@@ -213,11 +213,11 @@ const handleSignEthereum = function(recoveryRequest, key, skipConfirm) {
213
213
* Signs an Ethereum transaction.
214
214
* @param recoveryRequest The recovery request object.
215
215
* @param key The provided private key of the wallet.
216
- * @param kipConfirm The boolean value that indicates to whether or not to prompt the user to confirm the transaction.
217
- * @param isCoinToken The boolean value that indicates if the transaction is for erc20 or ETH.
216
+ * @param skipConfirm The boolean value that indicates to whether or not to prompt the user to confirm the transaction.
217
+ * @param isToken The boolean value that indicates if the transaction is for erc20 or ETH.
218
218
* @returns The 'hex' value of the signed transaction.
219
219
*/
220
- const signEthTx = function ( recoveryRequest , key , skipConfirm , isCoinToken ) {
220
+ const signEthTx = function ( recoveryRequest , key , skipConfirm , isToken ) {
221
221
const EthTx = require ( 'ethereumjs-tx' ) ;
222
222
223
223
const txHex = getTransactionHexFromRequest ( recoveryRequest ) ;
@@ -231,12 +231,12 @@ const signEthTx = function(recoveryRequest, key, skipConfirm, isCoinToken) {
231
231
} ] ;
232
232
233
233
// if request is for ETH, need to correct the amount decimals.
234
- if ( ! isCoinToken ) {
234
+ if ( ! isToken ) {
235
235
const decimals = coinDecimals [ recoveryRequest . coin ] ;
236
236
outputs [ 0 ] . amount = outputs [ 0 ] . amount . div ( TEN . pow ( decimals ) ) ;
237
237
}
238
238
239
- key = promptForConfirmatioAndKey ( recoveryRequest , key , outputs , skipConfirm ) ;
239
+ key = promptForConfirmationAndKey ( recoveryRequest , outputs , skipConfirm , key ) ;
240
240
241
241
transaction . sign ( getBackupSigningKey ( key , recoveryRequest . backupKey ) ) ;
242
242
@@ -257,7 +257,7 @@ const handleSignTrx = function(recoveryRequest, key, skipConfirm) {
257
257
} ;
258
258
} ) ;
259
259
260
- key = promptForConfirmatioAndKey ( recoveryRequest , key , outputs , skipConfirm ) ;
260
+ key = promptForConfirmationAndKey ( recoveryRequest , outputs , skipConfirm , key ) ;
261
261
262
262
builder . sign ( { key : getBackupSigningKey ( key , recoveryRequest . backupKey ) } ) ;
263
263
return JSON . stringify ( builder . build ( ) . toJson ( ) ) ;
@@ -284,7 +284,7 @@ const handleSignEos = function(recoveryRequest, key, skipConfirm) {
284
284
amount : new BN ( amount )
285
285
} ] ;
286
286
287
- key = promptForConfirmatioAndKey ( recoveryRequest , key , outputs , skipConfirm ) ;
287
+ key = promptForConfirmationAndKey ( recoveryRequest , outputs , skipConfirm , key ) ;
288
288
289
289
const dataToSign = utils . getEOSSignatureData ( packed_trx , chainId ) ;
290
290
const signBuffer = Buffer . from ( dataToSign , 'hex' ) ;
@@ -313,7 +313,7 @@ const handleSignXrp = function(recoveryRequest, key, skipConfirm) {
313
313
amount : ( new BN ( transaction . Amount ) ) . div ( TEN . pow ( decimals ) )
314
314
} ] ;
315
315
316
- key = promptForConfirmatioAndKey ( recoveryRequest , key , outputs , skipConfirm ) ;
316
+ key = promptForConfirmationAndKey ( recoveryRequest , outputs , skipConfirm , key ) ;
317
317
318
318
const backupKeyNode = getHDNodeAndVerify ( key , recoveryRequest . backupKey ) ;
319
319
@@ -349,7 +349,7 @@ const handleSignXlm = function(recoveryRequest, key, skipConfirm) {
349
349
amount : transaction . operations [ 0 ] . amount || transaction . operations [ 0 ] . startingBalance
350
350
} ] ;
351
351
352
- key = promptForConfirmatioAndKey ( recoveryRequest , key , outputs , skipConfirm ) ;
352
+ key = promptForConfirmationAndKey ( recoveryRequest , outputs , skipConfirm , key ) ;
353
353
354
354
let backupKeypair ;
355
355
0 commit comments