]> git.codecow.com Git - libnemo.git/commitdiff
Prioritize USB for Ledger for now.
authorChris Duncan <chris@zoso.dev>
Fri, 8 Aug 2025 19:44:32 +0000 (12:44 -0700)
committerChris Duncan <chris@zoso.dev>
Fri, 8 Aug 2025 19:44:32 +0000 (12:44 -0700)
src/lib/ledger.ts
src/lib/wallet.ts

index f524c7059ae9aee753b69ffa9419e0385658bc59..b7044a349db22018ee55463a686de594ed97f54e 100644 (file)
@@ -34,18 +34,18 @@ export class Ledger extends Wallet {
 \r
        /**\r
        * Check which transport protocols are supported by the browser and return the\r
-       * transport type according to the following priorities: Bluetooth, USB, HID.\r
+       * transport type according to the following priorities: USB, Bluetooth, HID.\r
        */\r
        static get isUnsupported (): boolean {\r
                console.log('Checking browser Ledger support...')\r
-               if (typeof globalThis.navigator?.bluetooth?.getDevices === 'function') {\r
-                       this.DynamicTransport = TransportBLE\r
-                       return false\r
-               }\r
                if (typeof globalThis.navigator?.usb?.getDevices === 'function') {\r
                        this.DynamicTransport = TransportUSB\r
                        return false\r
                }\r
+               if (typeof globalThis.navigator?.bluetooth?.getDevices === 'function') {\r
+                       this.DynamicTransport = TransportBLE\r
+                       return false\r
+               }\r
                if (typeof globalThis.navigator?.hid?.getDevices === 'function') {\r
                        this.DynamicTransport = TransportHID\r
                        return false\r
@@ -80,6 +80,7 @@ export class Ledger extends Wallet {
        }\r
 \r
        #accounts: AccountList\r
+       #safe: undefined\r
        #status: DeviceStatus = 'DISCONNECTED'\r
        get status (): DeviceStatus { return this.#status }\r
 \r
@@ -90,6 +91,7 @@ export class Ledger extends Wallet {
                Ledger.#isInternal = false\r
                super('Ledger')\r
                this.#accounts = new AccountList()\r
+               this.#safe = undefined\r
        }\r
 \r
        /**\r
index 840e9bee69698a0bd326f5284bb95138c7b8ea76..354fdc417c859c8ecb2a0ddc551c5ef4f78c0c49 100644 (file)
@@ -206,7 +206,7 @@ export class Wallet {
                Wallet.#isInternal = false\r
                this.#accounts = new AccountList()\r
                this.#id = id ?? crypto.randomUUID()\r
-               this.#safe = new WorkerQueue(type === 'Ledger' ? '' : SafeWorker)\r
+               this.#safe = new WorkerQueue(SafeWorker)\r
                this.#type = type\r
        }\r
 \r