From 7050b96365432add3aca9b679696e1bfee9c7aff Mon Sep 17 00:00:00 2001 From: meriadec Date: Tue, 29 May 2018 11:18:04 +0200 Subject: [PATCH] Pass sigHashType & isSegwit to signTransaction --- src/commands/libcoreSignAndBroadcast.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/commands/libcoreSignAndBroadcast.js b/src/commands/libcoreSignAndBroadcast.js index 310da766..9e3bea3f 100644 --- a/src/commands/libcoreSignAndBroadcast.js +++ b/src/commands/libcoreSignAndBroadcast.js @@ -6,6 +6,7 @@ import { createCommand, Command } from 'helpers/ipc' import { withDevice } from 'helpers/deviceAccess' import { getWalletIdentifier } from 'helpers/libcore' import { fromPromise } from 'rxjs/observable/fromPromise' +import { getCryptoCurrencyById } from '@ledgerhq/live-common/lib/helpers/currencies' type BitcoinLikeTransaction = { amount: number, @@ -55,7 +56,18 @@ const cmd: Command = createCommand( transactionBuilder.setFeesPerByte(fees) const builded = await transactionBuilder.build() - const signedTransaction = await core.signTransaction(hwApp, builded) + const sigHashType = core.helpers.bytesToHex( + njsWalletCurrency.bitcoinLikeNetworkParameters.SigHash, + ) + + const currency = getCryptoCurrencyById(account.currencyId) + const signedTransaction = await core.signTransaction({ + hwApp, + transaction: builded, + sigHashType, + supportsSegwit: currency.supportsSegwit, + isSegwit: account.isSegwit, + }) const txHash = await njsAccount .asBitcoinLikeAccount()