From: Chris Duncan Date: Mon, 11 Nov 2024 09:59:26 +0000 (-0800) Subject: Throw on invalid Ledger accounts. X-Git-Tag: v0.0.20~24 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=e27404e9b45b92643c9ab0fbdb8d01d9116b88ad;p=libnemo.git Throw on invalid Ledger accounts. --- diff --git a/src/lib/ckd.ts b/src/lib/ckd.ts index 615774e..4da80fd 100644 --- a/src/lib/ckd.ts +++ b/src/lib/ckd.ts @@ -62,10 +62,10 @@ async function ckdBlake2b (seed: string, index: number): Promise { * @param {number} index - Index of the account * @returns {Promise} */ -export async function ckdLedger (ledger: Ledger, index: number): Promise { +export async function ckdLedger (ledger: Ledger, index: number): Promise { const { status, publicKey } = await ledger.account(index) if (status === 'OK' && publicKey != null) { return await Account.fromPublicKey(publicKey, index) } - return null + throw new Error(`Error getting Ledger account: ${status}`) }