From 957cbee3b5b0c59c81e2254a1d2ff4f0363a003f Mon Sep 17 00:00:00 2001 From: Harpalsinh Jadeja Date: Tue, 4 Mar 2025 08:33:11 +0530 Subject: [PATCH] fix: complete todos --- .../hardhat/deployments/monadDevnet/.chainId | 1 - packages/nextjs/app/page.tsx | 8 +- packages/nextjs/components/Footer.tsx | 16 +- .../nextjs/contracts/deployedContracts.ts | 148 +++++++++++++++++- packages/nextjs/scaffold.config.ts | 4 +- packages/nextjs/utils/customChains.ts | 15 +- .../nextjs/utils/scaffold-eth/networks.ts | 6 +- 7 files changed, 174 insertions(+), 24 deletions(-) delete mode 100644 packages/hardhat/deployments/monadDevnet/.chainId diff --git a/packages/hardhat/deployments/monadDevnet/.chainId b/packages/hardhat/deployments/monadDevnet/.chainId deleted file mode 100644 index 94892a7..0000000 --- a/packages/hardhat/deployments/monadDevnet/.chainId +++ /dev/null @@ -1 +0,0 @@ -41454 \ No newline at end of file diff --git a/packages/nextjs/app/page.tsx b/packages/nextjs/app/page.tsx index 4465b50..2625915 100644 --- a/packages/nextjs/app/page.tsx +++ b/packages/nextjs/app/page.tsx @@ -45,8 +45,8 @@ const Home: NextPage = () => {

Get testnet funds from the{" "} - - {/* TODO: Add Faucet link here */}Faucet + + Faucet {" "}

@@ -64,8 +64,8 @@ const Home: NextPage = () => {

Explore your local transactions with the{" "} - - {/* TODO: Add Explorer link here */}Block Explorer + + Block Explorer {" "} tab.

diff --git a/packages/nextjs/components/Footer.tsx b/packages/nextjs/components/Footer.tsx index a812c72..a4021af 100644 --- a/packages/nextjs/components/Footer.tsx +++ b/packages/nextjs/components/Footer.tsx @@ -46,8 +46,12 @@ export const Footer = () => {
    - {/* TODO: add the scaffold-eth-monad repo link */} - + Fork me
    @@ -78,8 +82,12 @@ export const Footer = () => {
    ยท
    - - {/* TODO: Add link to github repo to create issue */} + Support
    diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index 008d4eb..11e1b86 100644 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -4,6 +4,152 @@ */ import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; -const deployedContracts = {} as const; +const deployedContracts = { + 10143: { + YourContract: { + address: "0x0e3C28aBCFF06D243788C9ef321a2D72715fC249", + abi: [ + { + inputs: [ + { + internalType: "address", + name: "_owner", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "greetingSetter", + type: "address", + }, + { + indexed: false, + internalType: "string", + name: "newGreeting", + type: "string", + }, + { + indexed: false, + internalType: "bool", + name: "premium", + type: "bool", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "GreetingChange", + type: "event", + }, + { + inputs: [], + name: "greeting", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "premium", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "_newGreeting", + type: "string", + }, + ], + name: "setGreeting", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "totalCounter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "userGreetingCounter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + stateMutability: "payable", + type: "receive", + }, + ], + inheritedFunctions: {}, + }, + }, +} as const; export default deployedContracts satisfies GenericContractsDeclaration; diff --git a/packages/nextjs/scaffold.config.ts b/packages/nextjs/scaffold.config.ts index 476e333..d415ad7 100644 --- a/packages/nextjs/scaffold.config.ts +++ b/packages/nextjs/scaffold.config.ts @@ -1,4 +1,4 @@ -import { monadDevnet } from "./utils/customChains"; +import { monadTestnet } from "./utils/customChains"; import * as chains from "viem/chains"; export type ScaffoldConfig = { @@ -11,7 +11,7 @@ export type ScaffoldConfig = { const scaffoldConfig = { // The networks on which your DApp is live - targetNetworks: [monadDevnet], + targetNetworks: [monadTestnet], // The interval at which your front-end polls the RPC servers for new data // it has no effect if you only target the local network (default is 4000) diff --git a/packages/nextjs/utils/customChains.ts b/packages/nextjs/utils/customChains.ts index 8d20dcf..b84cb9f 100644 --- a/packages/nextjs/utils/customChains.ts +++ b/packages/nextjs/utils/customChains.ts @@ -1,21 +1,18 @@ import { defineChain } from "viem"; -// TODO: Add Chain details here. -export const monadDevnet = defineChain({ - id: 41454, - name: "Monad Devnet", +export const monadTestnet = defineChain({ + id: 10143, + name: "Monad Testnet", nativeCurrency: { name: "Monad", symbol: "MON", decimals: 18 }, rpcUrls: { default: { - // TODO: Add Monad RPC URL - http: [""], + http: ["https://testnet-rpc.monad.xyz"], }, }, blockExplorers: { default: { - name: "Monad Devnet Blockscout", - // TODO: Add Explorer URL - url: "", + name: "Monad Testnet Explorer", + url: "https://testnet.monadexplorer.com", }, }, }); diff --git a/packages/nextjs/utils/scaffold-eth/networks.ts b/packages/nextjs/utils/scaffold-eth/networks.ts index 8b21143..fe26931 100644 --- a/packages/nextjs/utils/scaffold-eth/networks.ts +++ b/packages/nextjs/utils/scaffold-eth/networks.ts @@ -1,4 +1,4 @@ -import { monadDevnet } from "../customChains"; +import { monadTestnet } from "../customChains"; import * as chains from "viem/chains"; import scaffoldConfig from "~~/scaffold.config"; @@ -14,7 +14,7 @@ export type ChainWithAttributes = chains.Chain & Partial; // Mapping of chainId to RPC chain name an format followed by alchemy and infura export const RPC_CHAIN_NAMES: Record = { - [monadDevnet.id]: "monad-devnet", + [monadTestnet.id]: "monad-testnet", }; export const getAlchemyHttpUrl = (chainId: number) => { @@ -24,7 +24,7 @@ export const getAlchemyHttpUrl = (chainId: number) => { }; export const NETWORKS_EXTRA_DATA: Record = { - [monadDevnet.id]: { + [monadTestnet.id]: { color: "#200052", }, };