* @param {number} index - Index of the account
* @returns {Promise<Account>}
*/
-export async function ckdLedger (ledger: Ledger, index: number): Promise<Account | null> {
+export async function ckdLedger (ledger: Ledger, index: number): Promise<Account> {
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}`)
}