Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/pages/build/onchain-clients.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
});
Expand All @@ -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()
Expand Down