Skip to content

Commit 55c90d1

Browse files
committed
Add EtherScan API key
1 parent e52b241 commit 55c90d1

File tree

5 files changed

+19
-3
lines changed

5 files changed

+19
-3
lines changed

.env_example

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_PUBLIC_ETHERSCAN_API_KEY="AABB.."

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.eslintrc.cjs
22
.yarn/
3+
.env_example
34
node_modules/
45
dist/

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ dist-ssr
2929
*.njsproj
3030
*.sln
3131
*.sw?
32+
.env

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ ContractCompanion utilizes `evMole` to address problem 1 and `abi-guesser` for p
2020
for interacting with any contract on an EVM-based blockchain, enabling both reading and writing operations.
2121
You don’t need access to the ABI or source code — just provide the contract address or raw bytecode.
2222

23+
Note: The front-end supports browser wallets (no mobile wallets).
24+
2325
The technical details are:
2426

2527
The front-end extracts the function selectors and the input parameter types from the EVM bytecode, even for unverified contracts. If a signature is recognized (e.g., through lookups in the [database](https://docs.openchain.xyz/)), it displays the corresponding human-readable function names. Additionally, when reading data from a contract, the front-end analyzes the returned raw bytes to decode and present return parameters in a structured, human-readable format.
@@ -130,6 +132,10 @@ The recording shows how the decoding of the return parameter can be manually fin
130132
git clone https://github.com/DOBEN/ContractCompanion.git
131133
```
132134

135+
- Set up `EtherScan API` key:
136+
137+
Rename `.env_example` file to `.env` and insert your [EtherScan API key](https://docs.etherscan.io/getting-started/viewing-api-usage-statistics)
138+
133139
- Run `yarn` to install dependencies in the root folder of this project:
134140

135141
```

src/components/MainCard.tsx

+10-3
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,17 @@ export function MainCard(props: Props) {
113113
);
114114
}
115115

116+
const apiKey = import.meta.env.VITE_PUBLIC_ETHERSCAN_API_KEY;
117+
118+
if (!apiKey) {
119+
console.error("VITE_PUBLIC_ETHERSCAN_API_KEY is not defined.");
120+
}
121+
116122
try {
117-
byteCode = await new EtherscanProvider(effectiveNetwork).getCode(
118-
deriveFromContractAddress,
119-
);
123+
byteCode = await new EtherscanProvider(
124+
effectiveNetwork,
125+
apiKey,
126+
).getCode(deriveFromContractAddress);
120127
} catch (error) {
121128
const err = error as Error;
122129
setError(

0 commit comments

Comments
 (0)