From 0c02d90009f8e1d0a249d398b7931ecc1b5d8970 Mon Sep 17 00:00:00 2001 From: callumweb3 Date: Fri, 11 Sep 2026 14:42:41 +0100 Subject: [PATCH] docs(onchain-clients): add working Ethers.js example to block number section The "Example: Fetching the Current Block Number" section promised a code snippet but had none. Add a self-contained Ethers.js v6 example (ESM import, same RPC URL and chain ID as step 2 above). Verified on Windows CMD against https://rpc-gel-sepolia.inkonchain.com, chain ID 763373. Test success: `Current block number on Ink Sepolia: 60130592` --- src/pages/build/onchain-clients.mdx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/pages/build/onchain-clients.mdx b/src/pages/build/onchain-clients.mdx index 764fc518..9cad2875 100644 --- a/src/pages/build/onchain-clients.mdx +++ b/src/pages/build/onchain-clients.mdx @@ -39,6 +39,16 @@ To connect to Ink by instantiating a new `ethers.js` `JsonRpcProvider` object wi The following code snippet demonstrates how to fetch and print the current block number from Ink's testnet: +```javascript +import { ethers } from 'ethers'; + +const rpcUrl = 'https://rpc-gel-sepolia.inkonchain.com'; +const provider = new ethers.JsonRpcProvider(rpcUrl, 763373); + +const blockNumber = await provider.getBlockNumber(); +console.log(blockNumber); +``` + ## Viem - Instructions for Connecting to Ink Viem documentation: [https://viem.sh/docs/introduction](https://viem.sh/docs/introduction)