Skip to content

Commit

Permalink
Update ledger app and fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBenc authored and DavidTranDucVL committed Nov 25, 2020
1 parent 50e890e commit 40c9268
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"homepage": "https://github.com/vacuumlabs/cardano-hw-cli#readme",
"dependencies": {
"@babel/runtime": "^7.11.2",
"@cardano-foundation/ledgerjs-hw-app-cardano": "https://github.com/vacuumlabs/ledgerjs-cardano-shelley/releases/download/v2.0.2-rc.1/cardano-foundation-ledgerjs-hw-app-cardano-2.0.2-rc.1.tgz",
"@cardano-foundation/ledgerjs-hw-app-cardano": "https://github.com/vacuumlabs/ledgerjs-cardano-shelley/releases/download/v2.0.2-rc.2/cardano-foundation-ledgerjs-hw-app-cardano-2.0.2-rc.1.tgz",
"@ledgerhq/hw-transport-node-hid": "^5.25.0",
"argparse": "^2.0.1",
"bignumber": "^1.1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/crypto-providers/trezorCryptoProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ const TrezorCryptoProvider: () => Promise<CryptoProvider> = async () => {
certificates,
withdrawals,
})
if (response.error || !response.success) {
throw Error(Errors.TrezorSignTxError)
if (!response.success) {
throw Error(response.payload.error)
}
if (response.payload.hash !== txAux.getId()) {
throw Error(Errors.TxSerializationMismatchError)
Expand Down
6 changes: 3 additions & 3 deletions src/crypto-providers/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const findSigningPath = (
return signingFile?.path
}

const txHasPoolPoolRegistrationCert = (
const txHasStakePoolRegistrationCert = (
certs: _Certificate[],
): boolean => certs.some(
({ type }) => type === TxCertificateKeys.STAKEPOOL_REGISTRATION,
Expand Down Expand Up @@ -125,7 +125,7 @@ const validateWitnessing = (
stakeSigningFiles,
} = filterSigningFiles(signingFiles)
validateTx(txAux, paymentSigningFiles, stakeSigningFiles)
if (txHasPoolPoolRegistrationCert(txAux.certificates)) {
if (txHasStakePoolRegistrationCert(txAux.certificates)) {
validateTxWithPoolRegistration(txAux, paymentSigningFiles, stakeSigningFiles)
}
}
Expand All @@ -137,7 +137,7 @@ const validateSigning = (
paymentSigningFiles,
stakeSigningFiles,
} = filterSigningFiles(signingFiles)
if (txHasPoolPoolRegistrationCert(txAux.certificates)) throw Error(Errors.CantSignTxWithPoolRegError)
if (txHasStakePoolRegistrationCert(txAux.certificates)) throw Error(Errors.CantSignTxWithPoolRegError)
validateTx(txAux, paymentSigningFiles, stakeSigningFiles)
if (!paymentSigningFiles.length) throw Error(Errors.MissingPaymentSigningFileError)
}
Expand Down
1 change: 0 additions & 1 deletion src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable max-len */
enum Errors {
TrezorSignTxError = 'Error occured while signing the transaction with Trezor',
HwTransportNotFoundError = 'Error occured while trying to find hw transport, make sure Ledger or Trezor is connected to you computer',
InvalidPathError = 'Can not parse path',
InvalidFileTypeError = 'Invalid file type of hw-signing-file',
Expand Down
11 changes: 11 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@
bech32 "^1.1.4"
node-int64 "^0.4.0"

"@cardano-foundation/ledgerjs-hw-app-cardano@https://github.com/vacuumlabs/ledgerjs-cardano-shelley/releases/download/v2.0.2-rc.2/cardano-foundation-ledgerjs-hw-app-cardano-2.0.2-rc.1.tgz":
version "2.0.2-rc.1"
resolved "https://github.com/vacuumlabs/ledgerjs-cardano-shelley/releases/download/v2.0.2-rc.2/cardano-foundation-ledgerjs-hw-app-cardano-2.0.2-rc.1.tgz#015e0223559a3788868f396a73e2e2490b162487"
dependencies:
"@ledgerhq/hw-transport" "^5.12.0"
babel-polyfill "^6.26.0"
babel-runtime "^6.26.0"
base-x "^3.0.5"
bech32 "^1.1.4"
node-int64 "^0.4.0"

"@eslint/eslintrc@^0.2.1":
version "0.2.1"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.2.1.tgz#f72069c330461a06684d119384435e12a5d76e3c"
Expand Down

0 comments on commit 40c9268

Please sign in to comment.