0x9000: 'OK'
})
- static get UsbVendorId (): typeof ledgerUSBVendorId { return ledgerUSBVendorId }
-
/**
* Check which transport protocols are supported by the browser and return the
* transport type according to the following priorities: HID, Bluetooth, USB.
/**
* Status of the Ledger device connection.
*
- * DISCONNECTED | BUSY | LOCKED | CONNECTED
+ * UNSUPPORTED | DISCONNECTED | BUSY | LOCKED | CONNECTED
*/
- static get status (): LedgerStatus { return this.#status }
+ static get status (): LedgerStatus {
+ return this.isUnsupported ? 'UNSUPPORTED' : this.#status
+ }
+
+ /**
+ * Vendor ID assigned to Ledger for HID and USB interfaces.
+ */
+ static get UsbVendorId (): typeof ledgerUSBVendorId {
+ return ledgerUSBVendorId
+ }
/**
* Request an account at a specific BIP-44 index.
*
* @param {string} [api] Transport interface to use
* @returns Device status as follows:
+ * - UNSUPPORTED: Platform does not support any Ledger transport protocols
* - DISCONNECTED: Failed to communicate properly with the app
* - BUSY: Nano app is not currently open
* - LOCKED: Nano app is open but the device locked after a timeout
* - CONNECTED: Nano app is open and listening
*/
static async connect (api?: 'hid' | 'ble' | 'usb'): Promise<LedgerStatus> {
- if (Ledger.isUnsupported) {
- throw new Error('Browser is unsupported')
- }
if (api !== undefined) {
if (api === 'hid' && Ledger.#transport !== TransportHID) {
Ledger.#transport = TransportHID
console.error(err)
this.#status = 'DISCONNECTED'
}
- console.log(this.#status)
- return this.#status
+ console.log(this.status)
+ return this.status
}
/**