fix(wallet/pq): satisfy --strict exhaustive-switch narrowing

The switch in walletSchemeName covers every WalletSchemeID enum
value, so TypeScript --strict narrows the default arm's `s` to
`never` and rejects `s.toString(16)`. Cast through `number` for
the forward-compat fallback path.

No behaviour change; KAT vector for AccountID derivation
(chainID=9000, scheme=0x42) still matches the Go side at
76a03630148103ec558cf4d8f7e8a2d8766ea205d96a4529249c3aaf9c5d078cc9f9fdb8f21a5e7ef6bb4c4ea29c9654.
This commit is contained in:
Hanzo AI
2026-05-13 02:07:59 -07:00
parent 72c14dd03a
commit 86a4bdbe15
@@ -56,8 +56,14 @@ export function walletSchemeName(s: WalletSchemeID): string {
return 'ml-dsa-65'
case WalletSchemeID.MLDSA87:
return 'ml-dsa-87'
default:
return `wallet-scheme(0x${s.toString(16).padStart(2, '0')})`
default: {
// Forward-compat: a numeric scheme byte that does not match any
// known enum case still gets a readable name. The cast to number
// is required because the switch above is exhaustive over the
// enum and TypeScript narrows `s` to `never` here.
const raw = s as number
return `wallet-scheme(0x${raw.toString(16).padStart(2, '0')})`
}
}
}