diff --git a/utils/connect.js b/utils/connect.js index 16d8da28..552d0e27 100644 --- a/utils/connect.js +++ b/utils/connect.js @@ -1,10 +1,12 @@ const { connect: nearConnect } = require('near-api-js'); const { getConfig } = require('../config'); const { getPublicKeyForPath, signForPath } = require('./ledger'); +const chalk = require('chalk'); module.exports = async function connect({ keyStore, ...options }) { // If using Ledger, override the signer so that it uses the Ledger device if (options.signWithLedger) { + console.log(chalk`\nUsing Ledger with path {blue ${options.ledgerPath}}, change path with {blue --ledgerPath}\n`); options.signer = { getPublicKey: () => getPublicKeyForPath(options.ledgerPath), signMessage: (m) => signForPath(m, options.ledgerPath) diff --git a/utils/ledger.js b/utils/ledger.js index caccb13d..ba9ec453 100644 --- a/utils/ledger.js +++ b/utils/ledger.js @@ -18,10 +18,12 @@ async function getPublicKeyForPath(hdKeyPath) { // cache keys to avoid confirming on Ledger multiple times if (cachedPublicKeys[hdKeyPath]) return cachedPublicKeys[hdKeyPath]; + console.log('Trying to connect with Ledger...'); + transport = await TransportNodeHid.create(); client = await createClient(transport); - console.log('Getting Public Key from Ledger...'); + console.log('Getting public key from Ledger...'); try { const rawPublicKey = await client.getPublicKey(hdKeyPath);