set weight (v: bigint | number | string) { this.#weight = BigInt(v) }\r
\r
private constructor (address: Address, publicKey: Uint8Array<ArrayBuffer>, index?: number) {\r
- if (!this.constructor.prototype.#isInternal) {\r
+ if (!Account.#isInternal) {\r
throw new Error('Account cannot be instantiated directly. Use `load()` instead.')\r
}\r
- this.constructor.prototype.#isInternal = false\r
+ Account.#isInternal = false\r
this.#address = address\r
this.#publicKey = publicKey\r
this.#index = index\r
*/
static disconnect (): void {
setTimeout(async () => {
- const hidDevices = (await navigator?.hid?.getDevices?.())
+ const hidDevices = (await navigator?.hid?.getDevices?.() ?? [])
.filter(device => device.vendorId === this.ledgerVendorId)
.map(device => device.close())
- const usbDevices = (await navigator?.usb?.getDevices?.())
+ const usbDevices = (await navigator?.usb?.getDevices?.() ?? [])
.filter(device => device.vendorId === this.ledgerVendorId)
.map(device => device.close())
this.#status = 'DISCONNECTED'
*/
static async #poll (): Promise<void> {
try {
- const isHidPaired = (await navigator.hid?.getDevices())
+ const isHidPaired = (await navigator.hid?.getDevices?.() ?? [])
.some(device => device.vendorId === this.ledgerVendorId)
- const isUsbPaired = (await navigator.usb?.getDevices())
+ const isUsbPaired = (await navigator.usb?.getDevices?.() ?? [])
.some(device => device.vendorId === this.ledgerVendorId)
if (this.#transport === TransportHID && isHidPaired) {
await this.connect()