fix: null-Guard für log.data + Fallback-Warnung im RPC-Client (Review Task 4)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 08:03:30 +00:00
parent e926fa0988
commit 917bcad8c3

View File

@@ -30,7 +30,7 @@ export function decodeTransferLogs(logs: any[]): OnchainTransfer[] {
for (const log of logs) {
const token = TOKEN_BY_CONTRACT.get(String(log.address).toLowerCase());
if (!token) continue;
const raw = BigInt(log.data === '0x' ? '0x0' : log.data);
const raw = BigInt(!log.data || log.data === '0x' ? '0x0' : log.data);
out.push({
symbol: token.symbol,
instrument: token.instrument,
@@ -59,6 +59,7 @@ export async function rpc(method: string, params: unknown[]): Promise<any> {
return json.result;
} catch (err) {
lastErr = err;
console.warn(`RPC ${method} auf ${url} fehlgeschlagen — nächster Endpunkt:`, err instanceof Error ? err.message : err);
}
}
throw lastErr;