From f900b3a440b28f5ab9c67f73338db5fcdd2ba274 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Mon, 11 Nov 2024 02:02:06 -0800 Subject: [PATCH] Start testing ckd pool. --- src/lib/ckd.ts | 2 +- src/lib/wallet.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/ckd.ts b/src/lib/ckd.ts index e7ae52e..2b7508b 100644 --- a/src/lib/ckd.ts +++ b/src/lib/ckd.ts @@ -13,7 +13,7 @@ import type { Ledger } from './ledger.js' * @param {number} index - Index of the account * @returns {Promise} */ -onmessage = (event) => { +globalThis.onmessage = (event) => { let result = null const { type, seed, index } = event.data switch (type) { diff --git a/src/lib/wallet.ts b/src/lib/wallet.ts index 3ed559d..5da5323 100644 --- a/src/lib/wallet.ts +++ b/src/lib/wallet.ts @@ -7,13 +7,13 @@ import { nanoCKD } from './bip32-key-derivation.js' import { ADDRESS_GAP, SEED_LENGTH_BIP44, SEED_LENGTH_BLAKE2B } from './constants.js' import { bytes, dec } from './convert.js' import { Entropy } from './entropy.js' -// import { Pool } from './pool.js' +import { Pool } from './pool.js' import { Rpc } from './rpc.js' import { Safe } from './safe.js' import Tools from './tools.js' import type { Ledger } from './ledger.js' -// const ckdPool = new Pool('./ckd.js') +const ckdPool = new Pool('./ckd.js') /** * Represents a wallet containing numerous Nano accounts derived from a single @@ -393,9 +393,9 @@ export class Bip44Wallet extends Wallet { * @returns {Promise} */ async ckd (index: number): Promise { - const key = await nanoCKD(this.seed, index) - return await Account.fromPrivateKey(key, index) - // return await ckdPool.work({ type: 'bip44', seed: this.seed, index }) + // const key = await nanoCKD(this.seed, index) + // return await Account.fromPrivateKey(key, index) + return await ckdPool.work({ type: 'bip44', seed: this.seed, index }) } } -- 2.34.1