#TIL 17 - Call eth_sync | ProductsWay

#TIL 17 - Call eth_sync

Sep 7, 2021 · Dung Huynh

What

Call Ethereum JSON-RPC methods that ethers.js does not wrap (like eth_syncing) via provider.send.

Why

Ethers.js exposes many JSON-RPC methods as typed functions, but a particular version may not wrap every standard method. The underlying JsonRpcProvider.send(method, params) lets you call standard methods such as eth_syncing, as well as node-specific methods that your endpoint supports.

How

const provider = new ethers.providers.JsonRpcProvider(RPC_URL);
const syncing = await provider.send("eth_syncing", []);