From: Chris Duncan Date: Mon, 11 Nov 2024 10:02:06 +0000 (-0800) Subject: Start testing ckd pool. X-Git-Tag: v0.0.20~21 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=f900b3a440b28f5ab9c67f73338db5fcdd2ba274;p=libnemo.git Start testing ckd pool. --- 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 }) } }