]> git.codecow.com Git - libnemo.git/commitdiff
Validate frontiers RPC response.
authorChris Duncan <chris@codecow.com>
Mon, 3 Aug 2026 17:19:09 +0000 (10:19 -0700)
committerChris Duncan <chris@codecow.com>
Mon, 3 Aug 2026 17:19:09 +0000 (10:19 -0700)
src/lib/wallet/unopened.ts

index 14b40f0bdfbe3f4802061ca41af656c4a247a8a0..fc5ef3724f9efb43451c2e650fc380de11049473 100644 (file)
@@ -25,8 +25,9 @@ export async function _unopened (wallet: Wallet, rpc: unknown, batchSize: unknow
        const data = {
                "accounts": addresses
        }
-       const { errors } = await rpc.post('accounts_frontiers', data)
-       if (errors != null) {
+       const res = await rpc.post('accounts_frontiers', data)
+       if (res != null && typeof res === 'object' && 'errors' in res && res.errors != null && typeof res.errors === 'object') {
+               const errors = res.errors as Record<string, unknown>
                for (const a of addresses) {
                        const value = errors[a]
                        if (value === 'Account not found') {