@wopr-network/platform-core 1.61.1 → 1.61.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -284,8 +284,15 @@ export async function startWatchers(opts) {
|
|
|
284
284
|
if (!method.rpcUrl)
|
|
285
285
|
continue;
|
|
286
286
|
const rpcCall = createRpcCaller(method.rpcUrl);
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
let latestBlock;
|
|
288
|
+
try {
|
|
289
|
+
const latestHex = (await rpcCall("eth_blockNumber", []));
|
|
290
|
+
latestBlock = Number.parseInt(latestHex, 16);
|
|
291
|
+
}
|
|
292
|
+
catch (err) {
|
|
293
|
+
log("Skipping ETH watcher — RPC unreachable", { chain: method.chain, token: method.token, error: String(err) });
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
289
296
|
const backfillStart = Math.max(0, latestBlock - BACKFILL_BLOCKS);
|
|
290
297
|
const activeAddresses = await chargeStore.listActiveDepositAddresses();
|
|
291
298
|
// Only watch addresses for native charges on this chain (not ERC20 charges)
|
|
@@ -346,8 +353,15 @@ export async function startWatchers(opts) {
|
|
|
346
353
|
if (!method.rpcUrl || !method.contractAddress)
|
|
347
354
|
continue;
|
|
348
355
|
const rpcCall = createRpcCaller(method.rpcUrl);
|
|
349
|
-
|
|
350
|
-
|
|
356
|
+
let latestBlock;
|
|
357
|
+
try {
|
|
358
|
+
const latestHex = (await rpcCall("eth_blockNumber", []));
|
|
359
|
+
latestBlock = Number.parseInt(latestHex, 16);
|
|
360
|
+
}
|
|
361
|
+
catch (err) {
|
|
362
|
+
log("Skipping EVM watcher — RPC unreachable", { chain: method.chain, token: method.token, error: String(err) });
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
351
365
|
const activeAddresses = await chargeStore.listActiveDepositAddresses();
|
|
352
366
|
const chainAddresses = activeAddresses.filter((a) => a.chain === method.chain).map((a) => a.address);
|
|
353
367
|
const watcher = new EvmWatcher({
|
package/package.json
CHANGED
|
@@ -373,8 +373,14 @@ export async function startWatchers(opts: WatcherServiceOpts): Promise<() => voi
|
|
|
373
373
|
if (!method.rpcUrl) continue;
|
|
374
374
|
|
|
375
375
|
const rpcCall = createRpcCaller(method.rpcUrl);
|
|
376
|
-
|
|
377
|
-
|
|
376
|
+
let latestBlock: number;
|
|
377
|
+
try {
|
|
378
|
+
const latestHex = (await rpcCall("eth_blockNumber", [])) as string;
|
|
379
|
+
latestBlock = Number.parseInt(latestHex, 16);
|
|
380
|
+
} catch (err) {
|
|
381
|
+
log("Skipping ETH watcher — RPC unreachable", { chain: method.chain, token: method.token, error: String(err) });
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
378
384
|
const backfillStart = Math.max(0, latestBlock - BACKFILL_BLOCKS);
|
|
379
385
|
|
|
380
386
|
const activeAddresses = await chargeStore.listActiveDepositAddresses();
|
|
@@ -446,8 +452,14 @@ export async function startWatchers(opts: WatcherServiceOpts): Promise<() => voi
|
|
|
446
452
|
if (!method.rpcUrl || !method.contractAddress) continue;
|
|
447
453
|
|
|
448
454
|
const rpcCall = createRpcCaller(method.rpcUrl);
|
|
449
|
-
|
|
450
|
-
|
|
455
|
+
let latestBlock: number;
|
|
456
|
+
try {
|
|
457
|
+
const latestHex = (await rpcCall("eth_blockNumber", [])) as string;
|
|
458
|
+
latestBlock = Number.parseInt(latestHex, 16);
|
|
459
|
+
} catch (err) {
|
|
460
|
+
log("Skipping EVM watcher — RPC unreachable", { chain: method.chain, token: method.token, error: String(err) });
|
|
461
|
+
continue;
|
|
462
|
+
}
|
|
451
463
|
|
|
452
464
|
const activeAddresses = await chargeStore.listActiveDepositAddresses();
|
|
453
465
|
const chainAddresses = activeAddresses.filter((a) => a.chain === method.chain).map((a) => a.address);
|