How to use the @ledgerhq/hw-transport-node-hid.open function in @ledgerhq/hw-transport-node-hid

To help you get started, we’ve selected a few @ledgerhq/hw-transport-node-hid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LiskHQ / lisk-desktop / app / src / ledger.js View on Github external
export const executeLedgerCommand = (device, command) =>
  TransportNodeHid.open(device.path)
    // eslint-disable-next-line max-statements
    .then(async (transport) => {
      busy = true;

      try {
        const liskLedger = new DposLedger(transport);
        const ledgerAccount = getLedgerAccount(command.data.index);
        let res;

        if (command.action === 'GET_PUBLICKEY') {
          res = await liskLedger.getPubKey(ledgerAccount, command.data.showOnDevice);
          res = res.publicKey;
        }
        if (command.action === 'GET_ADDRESS') {
          res = await liskLedger.getPubKey(ledgerAccount, command.data.showOnDevice);
          res = res.address;
github nos / client / src / renderer / shared / wallet / common / Ledger.js View on Github external
async open() {
    try {
      // this.device = await retry(() => LedgerNode.open(this.path));
      this.device = await LedgerNode.open(this.path);
      return this;
    } catch (err) {
      throw evalTransportError(err);
    }
  }
github LedgerHQ / ledger-live-desktop / src / helpers / live-common-setup-internal-hw.js View on Github external
() =>
          getEnv('EXPERIMENTAL_USB')
            ? TransportNodeHidSingleton.open()
            : TransportNodeHid.open(devicePath),
        { maxRetry: 4 },
github hubiinetwork / hubii-core / src / electron / wallets / lns / index.js View on Github external
const createEthTransportActivity = async (descriptor, activityFn) => {
  let transport;
  try {
    if (process.platform === 'win32') {
      transport = await LedgerTransport.create();
    } else {
      transport = await LedgerTransport.open(descriptor);
    }
    const ethTransport = new Eth(transport);
    const result = await activityFn(ethTransport);
    return result;
  } finally {
    if (transport) {
      await transport.close();
    }
  }
};
github LedgerHQ / ledger-live-desktop / src / helpers / deviceAccess.js View on Github external
      const t = await retry(() => TransportNodeHid.open(devicePath), { maxRetry: 2 }).catch(
        mapError,
github hubiinetwork / hubii-core / src / utils / ledger / comms.js View on Github external
export const createEthTransportActivity = async (descriptor, activityFn) => {
  let transport;
  try {
    transport = await LedgerTransport.open(descriptor);
    const ethTransport = new Eth(transport);
    const result = await activityFn(ethTransport);
    return result;
  } finally {
    if (transport) {
      await transport.close();
    }
  }
};
github iov-one / iov-core / packages / iov-ledger-bns / src / exchange.ts View on Github external
const transport = await retry(async (): Promise => {
    try {
      return await TransportNodeHid.open(devicePath);
    } catch (e) {
      lastTransportOpenError = e;
      return undefined;
    }
  }, 14);
github CityOfZion / neon-wallet / app / ledger / neonLedger.js View on Github external
async open (): Promise {
    try {
      this.device = await LedgerNode.open(this.path)
      return this
    } catch (err) {
      throw evalTransportError(err)
    }
  }
github LiskHQ / lisk-desktop / app / src / ledger.js View on Github external
const getLiskAccount = async (path) => {
  let transport;
  try {
    transport = await TransportNodeHid.open(path);
    const liskLedger = new DposLedger(transport);
    const ledgerAccount = getLedgerAccount(0);
    const liskAccount = await liskLedger.getPubKey(ledgerAccount);
    transport.close();
    return liskAccount;
  } catch (e) {
    if (transport) transport.close();
    return null;
  }
};