Return 0 for balance queries for non-existant (new) accounts

This commit is contained in:
2026-09-10 16:17:37 +09:00
parent 8443e9a321
commit 47ca8d1475
@@ -68,7 +68,17 @@ public final class NodeClient {
@SuppressWarnings("unchecked")
public Map<String, Object> account(String accountId) throws Exception {
return (Map<String, Object>) request("/v3/accounts/" + accountId, "GET", null);
try {
return (Map<String, Object>) request("/v3/accounts/" + accountId, "GET", null);
} catch (Exception e) {
if (e.getMessage() != null && e.getMessage().contains("Account not found")) {
Map<String, Object> res = new HashMap<>();
res.put("id", accountId);
res.put("balance", 0);
return res;
}
throw e;
}
}
@SuppressWarnings("unchecked")