From edefaae5a2045e315b6f352070370cce8c071247 Mon Sep 17 00:00:00 2001 From: KENDAL Date: Mon, 24 Aug 2026 11:43:00 +0300 Subject: [PATCH] docs: update Hardhat snippets to Ethers v6 and streamline onchain clients example --- src/pages/build/onchain-clients.mdx | 12 ++++++------ .../tutorials/deploying-a-smart-contract/hardhat.mdx | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pages/build/onchain-clients.mdx b/src/pages/build/onchain-clients.mdx index 764fc518..75bb4e27 100644 --- a/src/pages/build/onchain-clients.mdx +++ b/src/pages/build/onchain-clients.mdx @@ -30,14 +30,14 @@ To connect to Ink by instantiating a new `ethers.js` `JsonRpcProvider` object wi 3. **Using the Provider**: You can now use the `provider` to interact with Ink's testnet. For example, you can fetch the current block number or interact with smart contracts deployed on the testnet. ```javascript - // previous code - const blockNumber = await provider.getBlockNumber(); - console.log(blockNumber); - ``` + import { ethers } from 'ethers'; -### Example: Fetching the Current Block Number + const rpcUrl = 'https://rpc-gel-sepolia.inkonchain.com'; + const provider = new ethers.JsonRpcProvider(rpcUrl, 763373); -The following code snippet demonstrates how to fetch and print the current block number from Ink's testnet: + const blockNumber = await provider.getBlockNumber(); + console.log('Current block number:', blockNumber); + ``` ## Viem - Instructions for Connecting to Ink diff --git a/src/pages/build/tutorials/deploying-a-smart-contract/hardhat.mdx b/src/pages/build/tutorials/deploying-a-smart-contract/hardhat.mdx index 4d2ad31e..fc5c2f9f 100644 --- a/src/pages/build/tutorials/deploying-a-smart-contract/hardhat.mdx +++ b/src/pages/build/tutorials/deploying-a-smart-contract/hardhat.mdx @@ -122,7 +122,7 @@ describe("InkContract", function () { it("Should return the correct greeting", async function () { const InkContract = await ethers.getContractFactory("InkContract"); const contract = await InkContract.deploy(); - await contract.deployed(); + await contract.waitForDeployment(); expect(await contract.greeting()).to.equal("Hello, Ink!"); }); @@ -144,9 +144,9 @@ async function main() { const InkContract = await ethers.getContractFactory("InkContract"); const contract = await InkContract.deploy(); - await contract.deployed(); + await contract.waitForDeployment(); - console.log("InkContract deployed to:", contract.address); + console.log("InkContract deployed to:", await contract.getAddress()); } main()