How to use the @ledgerhq/hw-transport-webusb.list function in @ledgerhq/hw-transport-webusb

To help you get started, we’ve selected a few @ledgerhq/hw-transport-webusb 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 shapeshift / hdwallet / packages / hdwallet-ledger-webusb / src / transport.ts View on Github external
export async function getFirstLedgerDevice(): Promise {
  if (!(window && window.navigator.usb))
    throw new WebUSBNotAvailable()

  const existingDevices = await TransportWebUSB.list()

  return existingDevices.length > 0 ? existingDevices[0] : null
}