if ('index' in obj && typeof obj.index === 'number') {\r
return true\r
}\r
- if ('privateKey' in obj && this.#isKey(obj.privateKey)) {\r
+ if ('publicKey' in obj && this.#isKey(obj.publicKey)) {\r
return true\r
}\r
- if ('publicKey' in obj && this.#isKey(obj.privateKey)) {\r
+ if ('privateKey' in obj && this.#isKey(obj.privateKey)) {\r
return true\r
}\r
}\r
* @returns {AccountList} Object with keys of account indexes and values of the corresponding Accounts\r
*/\r
async accounts (from: number = 0, to: number = from): Promise<AccountList> {\r
- if (this.#locked || this.#s == null) {\r
- throw new Error('wallet must be unlocked to derive accounts')\r
- }\r
if (from > to) {\r
const swap = from\r
from = to\r
publicKeys.push(keypair)\r
}\r
}\r
- const privateAccounts = await Account.import(privateKeys, this.seed)\r
- const publicAccounts = Account.import(publicKeys)\r
+ const privateAccounts = privateKeys.length > 0\r
+ ? await Account.import(privateKeys, this.seed)\r
+ : []\r
+ const publicAccounts = publicKeys.length > 0\r
+ ? Account.import(publicKeys)\r
+ : []\r
const accounts = [...privateAccounts, ...publicAccounts]\r
for (const a of accounts) {\r
if (a.index == null) {\r
import { failures, passes } from './GLOBALS.mjs'
import './test.runner-check.mjs'
-import './test.blake2b.mjs'
-import './test.blocks.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.blocks.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.tools.mjs'
+// import './test.lock-unlock.mjs'
+// import './test.manage-rolodex.mjs'
+// import './test.refresh-accounts.mjs'
+// import './test.tools.mjs'
console.log('%cTESTING COMPLETE', 'color:orange;font-weight:bold')
console.log('%cPASS: ', 'color:green;font-weight:bold', passes.length)
* shared among tests like wallet and account are declared at the top-level.
*/
await Promise.all([
- suite('Ledger hardware wallet', { skip: true || isNode }, async () => {
+ /* node:coverage disable */
+ suite('Ledger hardware wallet', { skip: false || isNode }, async () => {
let wallet, account, openBlock, sendBlock, receiveBlock
await assert.rejects(sendBlock.sign(0))
})
})
+ /* node:coverage enable */
])