Skip to content

Commit 2eb81f6

Browse files
[DDW-748] Implement upcoming LedgerJS breaking changes (#2697)
* [DDW-748] Update LedgerJS to the latest v4.0.0-multisig-rc1 version and fix address derivation * [DDW-748] Fix yarn.lock * [DDW-748] Add breaking changes to TX sign * [DDW-748] Update LedgerJS to the latest v4.0.0-RC4 * [DDW-748] Add LedgerJS breaking changes to delegation certs * [DDW-748] Update CHANGELOG * [DDW-748] Update LedgerJS to the latest v4.0.0-RC5 * [DDW-735] Merge and gix conflicts * [DDW-735] Merge and fix conflicts * [DDW-748] Changelog update * [DDW-748] Update LedgerJs to the official 4.0.0 version and fix yarn.lock * [DDW-748] Remove yarn.lock integrity hashes
1 parent 1c13cfa commit 2eb81f6

File tree

7 files changed

+27
-11
lines changed

7 files changed

+27
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
### Chores
1616

17+
- Covered LedgerJS v4.0.0 breaking changes ([PR 2697](https://github.com/input-output-hk/daedalus/pull/2697))
1718
- Added hardware wallet support for all non-public testnets ([PR 2672](https://github.com/input-output-hk/daedalus/pull/2672))
1819

1920
## 4.4.1

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
"yarn-lockfile": "1.1.1"
168168
},
169169
"dependencies": {
170-
"@cardano-foundation/ledgerjs-hw-app-cardano": "3.1.0",
170+
"@cardano-foundation/ledgerjs-hw-app-cardano": "4.0.0",
171171
"@iohk-jormungandr/wallet-js": "0.5.0-pre7",
172172
"@ledgerhq/hw-transport-node-hid": "5.51.1",
173173
"aes-js": "3.1.2",

source/common/types/hardware-wallets.types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ export type LedgerSignTransactionRequest = {
262262
validityIntervalStartStr?: ?string, // It is disabled for now
263263
signingMode: string,
264264
auxiliaryData: ?LedgerAuxiliaryDataType,
265+
additionalWitnessPaths: Array<?BIP32Path>,
265266
};
266267

267268
export type TrezorSignTransactionRequest = {

source/main/ipc/getHardwareWalletChannel.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,7 @@ export const handleHardwareWalletRequests = async (
754754
auxiliaryData,
755755
devicePath,
756756
signingMode,
757+
additionalWitnessPaths,
757758
} = params;
758759
logger.info('[HW-DEBUG] SIGN Ledger transaction');
759760
deviceConnection = devicePath
@@ -766,6 +767,7 @@ export const handleHardwareWalletRequests = async (
766767
}
767768
const signedTransaction = await deviceConnection.signTransaction({
768769
signingMode,
770+
additionalWitnessPaths,
769771
tx: {
770772
network: {
771773
networkId,

source/renderer/app/stores/HardwareWalletsStore.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ export default class HardwareWalletsStore extends Store {
11411141
const derivedAddress = await deriveAddressChannel.request({
11421142
devicePath: path,
11431143
isTrezor,
1144-
addressType: AddressType.BASE,
1144+
addressType: AddressType.BASE_PAYMENT_KEY_STAKE_KEY,
11451145
spendingPathStr: address.spendingPath,
11461146
stakingPathStr: `${SHELLEY_PURPOSE_INDEX}'/${ADA_COIN_TYPE}'/0'/2/0`,
11471147
networkId: hardwareWalletsNetworkConfig.networkId,
@@ -1242,7 +1242,7 @@ export default class HardwareWalletsStore extends Store {
12421242
await showAddressChannel.request({
12431243
devicePath: path,
12441244
isTrezor,
1245-
addressType: AddressType.BASE,
1245+
addressType: AddressType.BASE_PAYMENT_KEY_STAKE_KEY,
12461246
spendingPathStr: address.spendingPath,
12471247
stakingPathStr: `${SHELLEY_PURPOSE_INDEX}'/${ADA_COIN_TYPE}'/0'/2/0`,
12481248
networkId: hardwareWalletsNetworkConfig.networkId,
@@ -2081,6 +2081,7 @@ export default class HardwareWalletsStore extends Store {
20812081
certificates: certificatesData,
20822082
withdrawals: withdrawalsData,
20832083
signingMode: TransactionSigningMode.ORDINARY_TRANSACTION,
2084+
additionalWitnessPaths: [],
20842085
auxiliaryData,
20852086
devicePath,
20862087
});

source/renderer/app/utils/shelleyLedger.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
TxOutputDestinationType,
55
AddressType,
66
TxAuxiliaryDataType, // CHECK THIS
7+
StakeCredentialParamsType,
78
} from '@cardano-foundation/ledgerjs-hw-app-cardano';
89
import { encode } from 'borc';
910
import blakejs from 'blakejs';
@@ -252,7 +253,10 @@ export const prepareLedgerCertificate = (cert: CoinSelectionCertificate) => {
252253
return {
253254
type: CERTIFICATE_TYPE[cert.certificateType],
254255
params: {
255-
path: derivationPathToLedgerPath(cert.rewardAccountPath),
256+
stakeCredential: {
257+
type: StakeCredentialParamsType.KEY_PATH,
258+
keyPath: derivationPathToLedgerPath(cert.rewardAccountPath),
259+
},
256260
poolKeyHashHex: cert.pool
257261
? utils.buf_to_hex(utils.bech32_decodeAddress(cert.pool))
258262
: null,
@@ -264,7 +268,10 @@ export const prepareLedgerWithdrawal = (
264268
withdrawal: CoinSelectionWithdrawal
265269
) => {
266270
return {
267-
path: derivationPathToLedgerPath(withdrawal.derivationPath),
271+
stakeCredential: {
272+
type: StakeCredentialParamsType.KEY_PATH,
273+
keyPath: derivationPathToLedgerPath(withdrawal.derivationPath),
274+
},
268275
amount: withdrawal.amount.quantity.toString(),
269276
};
270277
};
@@ -442,7 +449,7 @@ export const prepareLedgerOutput = (
442449
destination: {
443450
type: TxOutputDestinationType.DEVICE_OWNED,
444451
params: {
445-
type: AddressType.BASE,
452+
type: AddressType.BASE_PAYMENT_KEY_STAKE_KEY,
446453
params: {
447454
spendingPath: derivationPathToLedgerPath(output.derivationPath),
448455
stakingPath: utils.str_to_path("1852'/1815'/0'/2/0"),
@@ -479,7 +486,7 @@ export const prepareLedgerAuxiliaryData = (
479486
votingPublicKeyHex: votingPubKey,
480487
stakingPath: rewardDestinationAddress.stakingPath,
481488
rewardsDestination: {
482-
type: AddressType.REWARD,
489+
type: AddressType.REWARD_KEY,
483490
params: {
484491
stakingPath: rewardDestinationAddress.stakingPath,
485492
},

yarn.lock

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,15 +1019,15 @@
10191019
lodash "^4.17.19"
10201020
to-fast-properties "^2.0.0"
10211021

1022-
"@cardano-foundation/ledgerjs-hw-app-cardano@3.1.0":
1023-
version "3.1.0"
1024-
resolved "https://registry.yarnpkg.com/@cardano-foundation/ledgerjs-hw-app-cardano/-/ledgerjs-hw-app-cardano-3.1.0.tgz#7b27501a0001cb31cfc3c59ac9398bd6596c0648"
1022+
"@cardano-foundation/ledgerjs-hw-app-cardano@4.0.0":
1023+
version "4.0.0"
1024+
resolved "https://registry.yarnpkg.com/@cardano-foundation/ledgerjs-hw-app-cardano/-/ledgerjs-hw-app-cardano-4.0.0.tgz#d4532b23e2ccd652f94a469106933aad821a65e7"
10251025
dependencies:
10261026
"@ledgerhq/hw-transport" "^5.12.0"
10271027
"@types/ledgerhq__hw-transport" "^4.21.3"
10281028
base-x "^3.0.5"
10291029
bech32 "^1.1.4"
1030-
node-int64 "^0.4.0"
1030+
int64-buffer "^1.0.1"
10311031

10321032
"@dump247/[email protected]":
10331033
version "1.6.1"
@@ -8661,6 +8661,10 @@ [email protected]:
86618661
version "0.99.1007"
86628662
resolved "https://registry.yarnpkg.com/int64-buffer/-/int64-buffer-0.99.1007.tgz#211ea089a2fdb960070a2e77cd6d17dc456a5220"
86638663

8664+
int64-buffer@^1.0.1:
8665+
version "1.0.1"
8666+
resolved "https://registry.yarnpkg.com/int64-buffer/-/int64-buffer-1.0.1.tgz#c78d841b444cadf036cd04f8683696c740f15dca"
8667+
86648668
internal-slot@^1.0.2:
86658669
version "1.0.2"
86668670
resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.2.tgz#9c2e9fb3cd8e5e4256c6f45fe310067fcfa378a3"

0 commit comments

Comments
 (0)