diff --git a/packages/nextjs/app/_components/BuildersCheckInCount.tsx b/packages/nextjs/app/_components/BuildersCheckInCount.tsx
index ba5cfcb..b971df9 100644
--- a/packages/nextjs/app/_components/BuildersCheckInCount.tsx
+++ b/packages/nextjs/app/_components/BuildersCheckInCount.tsx
@@ -1,24 +1,41 @@
-"use client";
-
-import React from "react";
import { CounterDisplay } from "./CounterDisplay";
-import { useScaffoldReadContract } from "~~/hooks/scaffold-eth";
+import { createPublicClient, getContract, http } from "viem";
+import { optimism } from "viem/chains";
-const CONTRACT_NAME = "BatchRegistry";
+const CONTRACT_ADR = "0x72ccAbE6620fa94eC69569d17f18a3914BEFBFD6";
const FUNCTION_NAME = "checkedInCounter";
-function BuildersCheckInCount() {
- // Get the result of the target function call from the deployed contract
- const {
- data: counter,
- isLoading,
- error,
- } = useScaffoldReadContract({
- contractName: CONTRACT_NAME,
- functionName: FUNCTION_NAME,
- });
+// Defining the ABI for just the function we need
+const BatchRegistryABI = [
+ {
+ name: FUNCTION_NAME,
+ type: "function",
+ stateMutability: "view",
+ inputs: [],
+ outputs: [{ type: "uint256" }],
+ },
+] as const;
+
+async function BuildersCheckInCount() {
+ try {
+ // A Client in the context of viem is similar to an Ethers.js Provider.
+ const publicClient = createPublicClient({
+ chain: optimism,
+ transport: http(),
+ });
+
+ const contract = getContract({
+ address: CONTRACT_ADR,
+ abi: BatchRegistryABI,
+ client: publicClient,
+ });
+
+ const counter = await contract.read.checkedInCounter();
- return
Get started by taking a look at your batch GitHub repository.
-