From 61563a6cee23abc9f086296680c2b684e8c21a3b Mon Sep 17 00:00:00 2001 From: "Sushant R. Dangal" Date: Fri, 19 Apr 2024 11:41:50 +0545 Subject: [PATCH] feature: defined contract address in .env --- next.config.mjs | 1 + src/lib/contractABI.ts | 72 +++++++++++++++++++++ src/views/Landing/components/PopUpModal.tsx | 3 +- 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 src/lib/contractABI.ts diff --git a/next.config.mjs b/next.config.mjs index 6b60f17..b6fbbe0 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -6,6 +6,7 @@ const nextConfig = { NEXT_PUBLIC_APP_ID: process.env.NEXT_PUBLIC_APP_ID, NEXT_PUBLIC_SERVER_URL: process.env.NEXT_PUBLIC_SERVER_URL, MORALIS_API_KEY: process.env.MORALIS_API_KEY, + SAI_CONTRACT_ADDRESS: process.env.SAI_CONTRACT_ADDRESS, }, // images: { // loader: process.env.NODE_ENV === "production" ? "custom" : "default", diff --git a/src/lib/contractABI.ts b/src/lib/contractABI.ts new file mode 100644 index 0000000..bafe7bf --- /dev/null +++ b/src/lib/contractABI.ts @@ -0,0 +1,72 @@ +export default function contractABI() { + const abi = [ + // Dummy Contract ABI + { + inputs: [ + { + internalType: "string", + name: "_name", + type: "string", + }, + { + internalType: "uint256", + name: "_age", + type: "uint256", + }, + ], + name: "createPerson", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_personAddress", + type: "address", + }, + ], + name: "getPerson", + outputs: [ + { + internalType: "string", + name: "name", + type: "string", + }, + { + internalType: "uint256", + name: "age", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "personAddress", + type: "address", + }, + { + indexed: false, + internalType: "string", + name: "name", + type: "string", + }, + { + indexed: false, + internalType: "uint256", + name: "age", + type: "uint256", + }, + ], + name: "PersonCreated", + type: "event", + }, + ]; +} diff --git a/src/views/Landing/components/PopUpModal.tsx b/src/views/Landing/components/PopUpModal.tsx index b0a6cd3..cb5533d 100644 --- a/src/views/Landing/components/PopUpModal.tsx +++ b/src/views/Landing/components/PopUpModal.tsx @@ -133,8 +133,9 @@ const PopUpModal = ({ isOpen }: { isOpen: boolean }) => { ethersProvider = new ethers.providers.Web3Provider(wallet.provider, "any"); } - const contractAddress = "0xe722C6833a0BF4B874C18C3f10cB54fD58A4180A"; + const contractAddress = `${process.env.SAI_CONTRACT_ADDRESS}`; // SAI's Contract Address const contractABI = [ + // Dummy Contract ABI { inputs: [ {