]> git.codecow.com Git - libnemo.git/commitdiff
Put window scrolling back in test page. Log to console when waiting for Ledger to...
authorChris Duncan <chris@zoso.dev>
Thu, 10 Jul 2025 15:29:55 +0000 (08:29 -0700)
committerChris Duncan <chris@zoso.dev>
Thu, 10 Jul 2025 15:29:55 +0000 (08:29 -0700)
index.html
src/lib/wallets/ledger-wallet.ts
test/GLOBALS.mjs
test/test.main.mjs

index b1a75c6cbc59eedcf2768849d1108c51b91e7208..f193df59ced011b332ad0eecc1dc13c61338fa2f 100644 (file)
@@ -41,6 +41,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
                                a = a.replace('%c', '<span style="font-weight:bold">')
                                output.innerHTML += `<pre>${a}</pre>`
                                consoleGroup(...args)
+                               window?.scrollTo(0, document.body.scrollHeight)
                        }
                        const consoleError = console.error
                        console.error = (...args) => {
@@ -48,6 +49,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
                                a = a.replace('%cFAIL ,color:red,', '<span style="color:red">FAIL </span>')
                                output.innerHTML += `<pre>${a}</pre>`
                                consoleError(...args)
+                               window?.scrollTo(0, document.body.scrollHeight)
                        }
                        const consoleLog = console.log
                        console.log = (...args) => {
@@ -58,6 +60,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
                                a = a.replace('%cTESTING COMPLETE,color:orange;font-weight:bold', '<span style="color:orange;font-weight:bold">TESTING COMPLETE</span>')
                                output.innerHTML += `<pre>${a}</pre>`
                                consoleLog(...args)
+                               window?.scrollTo(0, document.body.scrollHeight)
                        }
                })()
        </script>
index d62402ce60bb2035dea2807b11ea838c34319099..ec25851ef1d9bbf8025da03b38d932369eaca3d2 100644 (file)
@@ -233,6 +233,7 @@ export class LedgerWallet extends Wallet {
                if (typeof index !== 'number' || index < 0 || index >= HARDENED_OFFSET) {\r
                        throw new TypeError('Invalid account index')\r
                }\r
+               console.log('Waiting for signature confirmation on Ledger device...')\r
                if (input instanceof Uint8Array) {\r
                        // input is a nonce\r
                        return await this.#signNonce(index, input)\r
@@ -400,10 +401,8 @@ export class LedgerWallet extends Wallet {
                if (typeof index !== 'number' || index < 0 || index >= HARDENED_OFFSET) {\r
                        throw new TypeError('Invalid account index')\r
                }\r
-               const purpose = dec.toBytes(BIP44_PURPOSE + HARDENED_OFFSET, 4)\r
-               const coin = dec.toBytes(BIP44_COIN_NANO + HARDENED_OFFSET, 4)\r
                const account = dec.toBytes(index + HARDENED_OFFSET, 4)\r
-               const data = new Uint8Array([LEDGER_ADPU_CODES.bip32DerivationLevel, ...purpose, ...coin, ...account])\r
+               const data = new Uint8Array([...LedgerWallet.#derivationPath, ...account])\r
 \r
                const transport = await this.DynamicTransport.create(this.openTimeout, this.listenTimeout)\r
                const response = await transport\r
index d41178bbc1cb4289ff1eef9bf65b915d9301574e..88a44904067a0c7f5c42d508865d03d6e3a50f61 100644 (file)
@@ -195,7 +195,6 @@ export function test (name, opts, fn) {
        } else {
                fail(`${name}: test cannot execute on ${typeof fn} ${fn}`)
        }
-       window?.scrollTo(0, document.body.scrollHeight)
 }
 
 export const assert = {
index a2f78f9165fee01a69584c4cea5c468b2ff658ad..90f764482ce76a841260bac3a6225b97f7470dc4 100644 (file)
@@ -1,16 +1,16 @@
 // SPDX-FileCopyrightText: 2025 Chris Duncan <chris@zoso.dev>
 // SPDX-License-Identifier: GPL-3.0-or-later
 
-// import './test.blake2b.mjs'
-// import './test.calculate-pow.mjs'
-// import './test.create-wallet.mjs'
-// import './test.derive-accounts.mjs'
-// import './test.import-wallet.mjs'
+import './test.blake2b.mjs'
+import './test.calculate-pow.mjs'
+import './test.create-wallet.mjs'
+import './test.derive-accounts.mjs'
+import './test.import-wallet.mjs'
 import './test.ledger.mjs'
-// import './test.lock-unlock.mjs'
-// import './test.manage-rolodex.mjs'
-// import './test.refresh-accounts.mjs'
-// import './test.sign-blocks.mjs'
-// import './test.tools.mjs'
+import './test.lock-unlock.mjs'
+import './test.manage-rolodex.mjs'
+import './test.refresh-accounts.mjs'
+import './test.sign-blocks.mjs'
+import './test.tools.mjs'
 
 console.log('%cTESTING COMPLETE', 'color:orange;font-weight:bold')