From d99b9060e14739ac2f83a986a71d4725efde3ab3 Mon Sep 17 00:00:00 2001 From: port <108868128+portdeveloper@users.noreply.github.com> Date: Sun, 10 Mar 2024 12:50:07 +0300 Subject: [PATCH 01/23] Decompile ABI using a heimdall-rs backend --- packages/nextjs/pages/index.tsx | 200 ++++++++++++++++++++------------ 1 file changed, 123 insertions(+), 77 deletions(-) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 1cccdd91..24584ad6 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -18,6 +18,11 @@ enum TabName { addressAbi, } +enum AbiInputMethod { + Manual, + Heimdall, +} + const tabValues = Object.values(TabName) as TabName[]; const networks = getTargetNetworks(); @@ -29,8 +34,7 @@ const Home: NextPage = () => { const [localAbiContractAddress, setLocalAbiContractAddress] = useState(""); const [localContractAbi, setLocalContractAbi] = useState(""); const [isFetchingAbi, setIsFetchingAbi] = useState(false); - const [isCheckingContractAddress, setIsCheckingContractAddress] = useState(false); - const [isContract, setIsContract] = useState(false); + const [abiInputMethod, setAbiInputMethod] = useState(AbiInputMethod.Manual); const publicClient = usePublicClient({ chainId: parseInt(network), @@ -64,7 +68,25 @@ const Home: NextPage = () => { } catch (etherscanError: any) { setIsAbiAvailable(false); console.error("Error fetching ABI from Etherscan: ", etherscanError); - notification.error(etherscanError.message || "Error occurred while fetching ABI"); + + const bytecode = await publicClient.getBytecode({ + address: verifiedContractAddress, + }); + const isContract = Boolean(bytecode) && bytecode !== "0x"; + + if (isContract) { + notification.error( + "The contract is not verified on Etherscan. Please provide ABI manually or decompile ABI(experimental)", + { + duration: 10000, + position: "bottom-left", + }, + ); + setLocalAbiContractAddress(verifiedContractAddress); + setActiveTab(TabName.addressAbi); + } else { + notification.error("Address is not a contract, are you sure you are on the correct chain?"); + } } } finally { setIsFetchingAbi(false); @@ -82,35 +104,6 @@ const Home: NextPage = () => { } }, [verifiedContractAddress, network, setContractAbi]); - useEffect(() => { - const checkContract = async () => { - if (!isAddress(localAbiContractAddress)) { - setIsContract(false); - return; - } - - setIsCheckingContractAddress(true); - try { - const bytecode = await publicClient.getBytecode({ - address: localAbiContractAddress, - }); - const isContract = Boolean(bytecode) && bytecode !== "0x"; - setIsContract(isContract); - - if (!isContract) { - notification.error("Address is not a contract"); - } - } catch (e) { - notification.error("Error while checking for contract address"); - setIsContract(false); - } finally { - setIsCheckingContractAddress(false); - } - }; - - checkContract(); - }, [localAbiContractAddress, publicClient]); - useEffect(() => { if (router.pathname === "/") { setContractAbi([]); @@ -118,9 +111,9 @@ const Home: NextPage = () => { }, [router.pathname, setContractAbi]); const handleLoadContract = () => { - if (activeTab === TabName.verifiedContract) { + if (isAbiAvailable) { router.push(`/${verifiedContractAddress}/${network}`); - } else if (activeTab === TabName.addressAbi) { + } else if (localContractAbi.length > 0) { try { setContractAbi(parseAndCorrectJSON(localContractAbi)); } catch (error) { @@ -129,6 +122,26 @@ const Home: NextPage = () => { } setAbiContractAddress(localAbiContractAddress); router.push(`/${localAbiContractAddress}/${network}`); + } else { + fetchAbiFromHeimdall(localAbiContractAddress); + } + }; + + const fetchAbiFromHeimdall = async (contractAddress: string) => { + setIsFetchingAbi(true); + try { + const response = await fetch(`https://heimdall-api-cool-frog-2068.fly.dev/${network}/${contractAddress}`); + const abi = await response.json(); + setContractAbi(abi); + setIsAbiAvailable(true); + setAbiContractAddress(contractAddress); + router.push(`/${contractAddress}/${network}`); + } catch (error) { + console.error("Error fetching ABI from Heimdall: ", error); + notification.error("Failed to fetch ABI from Heimdall. Please try again or enter ABI manually."); + setIsAbiAvailable(false); + } finally { + setIsFetchingAbi(false); } }; @@ -145,31 +158,6 @@ const Home: NextPage = () => { setNetwork(option ? option.value.toString() : "")} /> -
- setActiveTab(TabName.verifiedContract)} - > - Verified Contract - - setActiveTab(TabName.addressAbi)} - > - Address + ABI - -
-
{tabValues.map(tabValue => ( @@ -187,7 +175,7 @@ const Home: NextPage = () => {
@@ -218,38 +206,96 @@ const Home: NextPage = () => {
) : ( -
- - +
+ {/* Tab navigation */} + +
+
setAbiInputMethod(AbiInputMethod.Manual)} + > + Input ABI Manually +
+
setAbiInputMethod(AbiInputMethod.Heimdall)} + > + Decompile ABI +
+
+ + {/* Content based on active tab */} + {abiInputMethod === AbiInputMethod.Manual ? ( + <> + + + + ) : ( + <> + + + )}
)}
))}
+ {activeTab !== TabName.verifiedContract && abiInputMethod === AbiInputMethod.Heimdall && ( +
+ Warning: this feature is experimental. You may lose funds if you interact with contracts using this + feature. +
+ )}
+ {activeTab === TabName.addressAbi && ( +
{ + setActiveTab(TabName.verifiedContract); + setVerifiedContractAddress(""); + }} + > + ← go back +
+ )} + From ce5d6e8128d68d87bf3fa1a1783454a98ac9db7a Mon Sep 17 00:00:00 2001 From: port <108868128+portdeveloper@users.noreply.github.com> Date: Tue, 12 Mar 2024 20:34:44 +0300 Subject: [PATCH 02/23] Better placement of go back button and input --- packages/nextjs/pages/index.tsx | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 24584ad6..52c205be 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -154,11 +154,23 @@ const Home: NextPage = () => { logo

ABI Ninja

Interact with any contract on Ethereum

-
+
setNetwork(option ? option.value.toString() : "")} />
- -
+ {activeTab === TabName.addressAbi && ( +
{ + setActiveTab(TabName.verifiedContract); + setVerifiedContractAddress(""); + }} + > + ← go back +
+ )} + {/* placeholder to match height @todo make this better, bad practice! */} + {activeTab === TabName.verifiedContract &&
} +
{tabValues.map(tabValue => (
{ ) : (
{/* Tab navigation */} -
{ )}
- {activeTab === TabName.addressAbi && ( -
{ - setActiveTab(TabName.verifiedContract); - setVerifiedContractAddress(""); - }} - > - ← go back -
- )} - +
+
Quick Access
+
+ + DAI + + + Gitcoin + + + Opensea + +
+
+
+ ) : ( +
+
+ + logo +
+ setNetwork(option ? option.value.toString() : "")} + additionalClasses="text-xs w-28" /> -
-
Quick Access
-
- - DAI - - - Gitcoin - - - Opensea - -
-
- ) : ( -
- {/* Tab navigation */} -
-
setAbiInputMethod(AbiInputMethod.Manual)} - > - Input ABI Manually -
-
setAbiInputMethod(AbiInputMethod.Heimdall)} - > - Decompile ABI -
-
+
- {/* Content based on active tab */} - {abiInputMethod === AbiInputMethod.Manual ? ( - <> - - - - ) : ( - <> - - - )} +
+
+ +

Contract not verified

- )} +

+ {localAbiContractAddress} +

+

+ You can decompile the contract (beta) or import the ABI manually below. +

+ +
+
+

Manually import ABI

+ + +
- ))} + )}
- {activeTab !== TabName.verifiedContract && abiInputMethod === AbiInputMethod.Heimdall && ( -
- Warning: this feature is experimental. You may lose funds if you interact with contracts using this - feature. -
- )} -
- - + ))}
- + {activeTab === TabName.verifiedContract && }
From a2db5995814319bba61971f4a09836dc5c7da5d7 Mon Sep 17 00:00:00 2001 From: tokodev Date: Fri, 29 Mar 2024 00:27:55 +0100 Subject: [PATCH 07/23] Missing padding change from PR #75 --- packages/nextjs/pages/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 344f40b8..b9375052 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -148,7 +148,7 @@ const Home: NextPage = () => { <>
-
+
{tabValues.map(tabValue => (
Date: Fri, 29 Mar 2024 11:29:21 +0300 Subject: [PATCH 08/23] Remove err notif saying contract not verified --- packages/nextjs/pages/index.tsx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index b9375052..a51bb4c4 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -70,13 +70,6 @@ const Home: NextPage = () => { const isContract = Boolean(bytecode) && bytecode !== "0x"; if (isContract) { - notification.error( - "The contract is not verified on Etherscan. Please provide ABI manually or decompile ABI(experimental)", - { - duration: 10000, - position: "bottom-left", - }, - ); setLocalAbiContractAddress(verifiedContractAddress); setActiveTab(TabName.addressAbi); } else { From 7f98e235f3ff2fb578629013f850e19a97a6978a Mon Sep 17 00:00:00 2001 From: port <108868128+portdeveloper@users.noreply.github.com> Date: Fri, 29 Mar 2024 11:31:18 +0300 Subject: [PATCH 09/23] Disable network dropdown in second step(abi/heimdall) --- packages/nextjs/pages/index.tsx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index a51bb4c4..7aaec666 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -219,12 +219,6 @@ const Home: NextPage = () => { Go back logo -
- setNetwork(option ? option.value.toString() : "")} - additionalClasses="text-xs w-28" - /> -
From 267c0af118882fc1123778967403f174aa793801 Mon Sep 17 00:00:00 2001 From: tokodev Date: Fri, 29 Mar 2024 23:56:26 +0100 Subject: [PATCH 10/23] Small spacing tweaks on new screen --- packages/nextjs/pages/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 7aaec666..82bbdc64 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -218,7 +218,7 @@ const Home: NextPage = () => { Go back - logo + logo
@@ -229,22 +229,22 @@ const Home: NextPage = () => {

{localAbiContractAddress}

-

+

You can decompile the contract (beta) or import the ABI manually below.

-
-

Manually import ABI

+
+

Manually import ABI

-
From f07871fe61e0faa647f7d96c63e0220aa3c58462 Mon Sep 17 00:00:00 2001 From: tokodev Date: Sat, 30 Mar 2024 00:13:58 +0100 Subject: [PATCH 11/23] Tweak homepage spacing --- packages/nextjs/pages/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 82bbdc64..a4d2952d 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -178,8 +178,8 @@ const Home: NextPage = () => { > {isFetchingAbi ? : "Load Contract"} -
-
Quick Access
+
+
Quick Access
Date: Sat, 30 Mar 2024 00:14:48 +0100 Subject: [PATCH 12/23] Fix dropdown showing scrollbar on homepage --- packages/nextjs/components/NetworksDropdown.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/nextjs/components/NetworksDropdown.tsx b/packages/nextjs/components/NetworksDropdown.tsx index fb8e893b..b43c52e9 100644 --- a/packages/nextjs/components/NetworksDropdown.tsx +++ b/packages/nextjs/components/NetworksDropdown.tsx @@ -94,6 +94,9 @@ export const NetworksDropdown = ({ primary: "#551d98", }, })} + styles={{ + menuList: provided => ({ ...provided, maxHeight: 280, overflow: "auto" }), + }} /> ); }; From 3345c3ccf21ef4f9a7529788c8a38b664211c6c9 Mon Sep 17 00:00:00 2001 From: tokodev Date: Sat, 30 Mar 2024 00:15:18 +0100 Subject: [PATCH 13/23] Fix footer not being clickable --- packages/nextjs/components/MiniFooter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextjs/components/MiniFooter.tsx b/packages/nextjs/components/MiniFooter.tsx index b1aff937..ad757317 100644 --- a/packages/nextjs/components/MiniFooter.tsx +++ b/packages/nextjs/components/MiniFooter.tsx @@ -3,7 +3,7 @@ import { BuidlGuidlLogo } from "~~/components/assets/BuidlGuidlLogo"; export const MiniFooter = () => { return ( -
From 33961b89dde91887827e5cbcc2d2488c94d24d20 Mon Sep 17 00:00:00 2001 From: tokodev Date: Sat, 30 Mar 2024 00:22:55 +0100 Subject: [PATCH 15/23] Set same hover effect to new screen buttons --- packages/nextjs/pages/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 3f047109..95c77b88 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -232,7 +232,10 @@ const Home: NextPage = () => {

You can decompile the contract (beta) or import the ABI manually below.

-
@@ -244,7 +247,10 @@ const Home: NextPage = () => { value={localContractAbi} onChange={e => setLocalContractAbi(e.target.value)} > -
From 0cba3a06d3c5064637b676caf5e37997d0efda83 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Mon, 1 Apr 2024 19:19:54 +0530 Subject: [PATCH 16/23] remove goerli + OPGoerli --- packages/nextjs/scaffold.config.ts | 2 -- packages/nextjs/utils/scaffold-eth/networks.ts | 16 ---------------- 2 files changed, 18 deletions(-) diff --git a/packages/nextjs/scaffold.config.ts b/packages/nextjs/scaffold.config.ts index 6096fdee..9025f48b 100644 --- a/packages/nextjs/scaffold.config.ts +++ b/packages/nextjs/scaffold.config.ts @@ -20,9 +20,7 @@ const scaffoldConfig = { localhost, chains.mainnet, chains.sepolia, - chains.goerli, chains.optimism, - chains.optimismGoerli, chains.base, chains.baseSepolia, chains.polygon, diff --git a/packages/nextjs/utils/scaffold-eth/networks.ts b/packages/nextjs/utils/scaffold-eth/networks.ts index ebec9643..0af1d5cf 100644 --- a/packages/nextjs/utils/scaffold-eth/networks.ts +++ b/packages/nextjs/utils/scaffold-eth/networks.ts @@ -40,12 +40,6 @@ export const NETWORKS_EXTRA_DATA: Record = { etherscanApiKey: MAINNET_ETHERSCAN_API_KEY, icon: "/mainnet.svg", }, - [chains.goerli.id]: { - color: "#0975F6", - etherscanEndpoint: "https://api-goerli.etherscan.io", - etherscanApiKey: MAINNET_ETHERSCAN_API_KEY, - icon: "/mainnet.svg", - }, [chains.gnosis.id]: { color: "#48a9a6", etherscanEndpoint: "https://api.gnosisscan.io", @@ -66,22 +60,12 @@ export const NETWORKS_EXTRA_DATA: Record = { etherscanApiKey: POLYGON_ETHERSCAN_API_KEY, icon: "/polygon.svg", }, - [chains.optimismGoerli.id]: { - color: "#f01a37", - etherscanEndpoint: "https://api-goerli-optimistic.etherscan.io", - etherscanApiKey: OPTIMISM_ETHERSCAN_API_KEY, - icon: "/optimism.svg", - }, [chains.optimism.id]: { color: "#f01a37", etherscanEndpoint: "https://api-optimistic.etherscan.io", etherscanApiKey: OPTIMISM_ETHERSCAN_API_KEY, icon: "/optimism.svg", }, - [chains.arbitrumGoerli.id]: { - color: "#28a0f0", - icon: "/arbitrum.jpg", - }, [chains.arbitrum.id]: { color: "#28a0f0", etherscanEndpoint: "https://api.arbiscan.io", From b4758686ed05eb9be3f4210df0bceb6da2886f31 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Mon, 1 Apr 2024 19:21:38 +0530 Subject: [PATCH 17/23] remove additionalClasses from NetworksDropdown --- packages/nextjs/components/NetworksDropdown.tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/nextjs/components/NetworksDropdown.tsx b/packages/nextjs/components/NetworksDropdown.tsx index b43c52e9..903128dd 100644 --- a/packages/nextjs/components/NetworksDropdown.tsx +++ b/packages/nextjs/components/NetworksDropdown.tsx @@ -56,13 +56,7 @@ const IconOption = (props: OptionProps) => ( ); -export const NetworksDropdown = ({ - onChange, - additionalClasses, -}: { - onChange: (options: any) => any; - additionalClasses?: string; -}) => { +export const NetworksDropdown = ({ onChange }: { onChange: (options: any) => any }) => { const [isMobile, setIsMobile] = useState(false); useEffect(() => { @@ -84,7 +78,7 @@ export const NetworksDropdown = ({ onChange={onChange} components={{ Option: IconOption }} isSearchable={!isMobile} - className={`max-w-xs bg-white relative ${additionalClasses ? additionalClasses : "text-sm w-44"}`} + className="max-w-xs bg-white relative text-sm w-44" theme={theme => ({ ...theme, colors: { From fc63d461bbcfc85fbf543ea89696b722f53f0cf3 Mon Sep 17 00:00:00 2001 From: port <108868128+portdeveloper@users.noreply.github.com> Date: Wed, 3 Apr 2024 23:26:53 +0300 Subject: [PATCH 18/23] Check abi length and return if its 0 --- packages/nextjs/pages/index.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 95c77b88..afc2a4aa 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -124,6 +124,11 @@ const Home: NextPage = () => { try { const response = await fetch(`https://heimdall-api.fly.dev/${network}/${contractAddress}`); const abi = await response.json(); + if (abi.length === 0) { + notification.error("Failed to fetch ABI from Heimdall. Please try again or enter ABI manually."); + setIsFetchingAbi(false); + return; + } setContractAbi(abi); setIsAbiAvailable(true); setAbiContractAddress(contractAddress); From 7455ceffa5756baecfd8f8d1ff2f1f29d282a488 Mon Sep 17 00:00:00 2001 From: port <108868128+portdeveloper@users.noreply.github.com> Date: Sat, 13 Apr 2024 10:55:23 +0300 Subject: [PATCH 19/23] Add missing import + dep to dep array --- packages/nextjs/pages/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 6a682bde..2e201976 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -12,6 +12,7 @@ import { MetaHeader } from "~~/components/MetaHeader"; import { MiniFooter } from "~~/components/MiniFooter"; import { NetworksDropdown } from "~~/components/NetworksDropdown"; import { AddressInput } from "~~/components/scaffold-eth"; +import scaffoldConfig from "~~/scaffold.config"; import { useAbiNinjaState } from "~~/services/store/store"; import { fetchContractABIFromAnyABI, fetchContractABIFromEtherscan, parseAndCorrectJSON } from "~~/utils/abi"; import { getTargetNetworks, notification } from "~~/utils/scaffold-eth"; @@ -118,8 +119,7 @@ const Home: NextPage = () => { } else { setIsAbiAvailable(false); } - }, [verifiedContractAddress, network, setContractAbi, publicClient]); - + }, [verifiedContractAddress, network, setContractAbi, publicClient, setImplementationAddress]); useEffect(() => { if (router.pathname === "/") { From 8b222cce309b56a206075ed798ac9c6af1dda5f7 Mon Sep 17 00:00:00 2001 From: port <108868128+portdeveloper@users.noreply.github.com> Date: Mon, 15 Apr 2024 21:39:03 +0300 Subject: [PATCH 20/23] Remove scaffoldConfig import --- packages/nextjs/pages/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index d7d36a1f..f1aa6845 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -10,7 +10,6 @@ import { MetaHeader } from "~~/components/MetaHeader"; import { MiniFooter } from "~~/components/MiniFooter"; import { NetworksDropdown } from "~~/components/NetworksDropdown"; import { AddressInput } from "~~/components/scaffold-eth"; -import scaffoldConfig from "~~/scaffold.config"; import { useAbiNinjaState } from "~~/services/store/store"; import { fetchContractABIFromAnyABI, fetchContractABIFromEtherscan, parseAndCorrectJSON } from "~~/utils/abi"; import { detectProxyTarget } from "~~/utils/abi-ninja/proxyContracts"; From 59ede1531477bac16d53d50d54208e3a705407c1 Mon Sep 17 00:00:00 2001 From: port <108868128+portdeveloper@users.noreply.github.com> Date: Wed, 17 Apr 2024 20:34:29 +0300 Subject: [PATCH 21/23] Add heimdall backend url as env var --- packages/nextjs/.env.example | 1 + packages/nextjs/pages/index.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/nextjs/.env.example b/packages/nextjs/.env.example index 1d5ae40f..a81d3b0c 100644 --- a/packages/nextjs/.env.example +++ b/packages/nextjs/.env.example @@ -16,6 +16,7 @@ NEXT_PUBLIC_POLYGON_ETHERSCAN_API_KEY= NEXT_PUBLIC_ARBITRUM_ETHERSCAN_API_KEY= NEXT_PUBLIC_SCROLL_ETHERSCAN_API_KEY= NEXT_PUBLIC_BASE_ETHERSCAN_API_KEY= +NEXT_PUBLIC_HEIMDALL_URL= NEXT_PUBLIC_ALCHEMY_API_KEY= NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID= diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index f1aa6845..6bb9186a 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -133,7 +133,7 @@ const Home: NextPage = () => { const fetchAbiFromHeimdall = async (contractAddress: string) => { setIsFetchingAbi(true); try { - const response = await fetch(`https://heimdall-api.fly.dev/${network}/${contractAddress}`); + const response = await fetch(`https://${process.env.NEXT_PUBLIC_HEIMDALL_URL}/${network}/${contractAddress}`); const abi = await response.json(); if (abi.length === 0) { notification.error("Failed to fetch ABI from Heimdall. Please try again or enter ABI manually."); From fd66bc0105002b107dab1524cec2a702822834f2 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Fri, 19 Apr 2024 20:31:57 +0530 Subject: [PATCH 22/23] remove https:// from heimdall url --- packages/nextjs/pages/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 6bb9186a..708bf13e 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -133,7 +133,7 @@ const Home: NextPage = () => { const fetchAbiFromHeimdall = async (contractAddress: string) => { setIsFetchingAbi(true); try { - const response = await fetch(`https://${process.env.NEXT_PUBLIC_HEIMDALL_URL}/${network}/${contractAddress}`); + const response = await fetch(`${process.env.NEXT_PUBLIC_HEIMDALL_URL}/${network}/${contractAddress}`); const abi = await response.json(); if (abi.length === 0) { notification.error("Failed to fetch ABI from Heimdall. Please try again or enter ABI manually."); From 1592c0fa844d7feb1447560f85883d50602d4db5 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Fri, 19 Apr 2024 22:13:04 +0530 Subject: [PATCH 23/23] fix bug from (#86) default network a mainnet at 0th index --- packages/nextjs/pages/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 708bf13e..3bc43ac9 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -26,7 +26,7 @@ const networks = getTargetNetworks(); const Home: NextPage = () => { const [activeTab, setActiveTab] = useState(TabName.verifiedContract); - const [network, setNetwork] = useState(networks[1].id.toString()); + const [network, setNetwork] = useState(networks[0].id.toString()); const [verifiedContractAddress, setVerifiedContractAddress] = useState
(""); const [localAbiContractAddress, setLocalAbiContractAddress] = useState(""); const [localContractAbi, setLocalContractAbi] = useState("");