console.log(e)
if (e.device?.vendorId === ledgerUSBVendorId) {
console.log('Ledger connected via HID')
+ await this.connect()
this.#polling = setInterval(this.connect, 1000)
const { hid } = globalThis.navigator
hid.addEventListener('disconnect', this.#onDisconnectHid)
if (e.device?.vendorId === ledgerUSBVendorId) {
console.log('Ledger disconnected via HID')
clearInterval(this.#polling)
+ await this.connect()
const { hid } = globalThis.navigator
hid.addEventListener('connect', this.#onConnectHid)
hid.removeEventListener('disconnect', this.#onDisconnectHid)
console.log(e)
if (e.device?.vendorId === ledgerUSBVendorId) {
console.log('Ledger connected via USB')
+ await this.connect()
this.#polling = setInterval(this.connect, 1000)
const { usb } = globalThis.navigator
usb.addEventListener('disconnect', this.#onDisconnectUsb)
if (e.device?.vendorId === ledgerUSBVendorId) {
console.log('Ledger disconnected via USB')
clearInterval(this.#polling)
+ await this.connect()
const { usb } = globalThis.navigator
usb.addEventListener('connect', this.#onConnectUsb)
usb.removeEventListener('disconnect', this.#onDisconnectUsb)