]> git.codecow.com Git - libnemo.git/commitdiff
Fix private property access.
authorChris Duncan <chris@zoso.dev>
Sat, 20 Sep 2025 22:09:53 +0000 (15:09 -0700)
committerChris Duncan <chris@zoso.dev>
Sat, 20 Sep 2025 22:09:53 +0000 (15:09 -0700)
src/lib/account/index.ts
src/lib/ledger.ts

index 2bfb6fc4b4a72f803f42ca55e225d2b11f7cc30b..f6b70b3f58edde14a23c4304144ee195d3356afe 100644 (file)
@@ -113,10 +113,10 @@ export class Account {
        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
index 7c49045b324043c52174c9d9d98458bf260a1158..8c83c5ff2b0f11e3c97eadaf4e75b06fb1099488 100644 (file)
@@ -219,10 +219,10 @@ export class Ledger {
        */
        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'
@@ -471,9 +471,9 @@ export class Ledger {
        */
        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()