From e27404e9b45b92643c9ab0fbdb8d01d9116b88ad Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Mon, 11 Nov 2024 01:59:26 -0800 Subject: [PATCH] Throw on invalid Ledger accounts. --- src/lib/ckd.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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}`) } -- 2.34.1