Skip to content

Commit f92ebe8

Browse files
fix PR comments
1 parent 9904836 commit f92ebe8

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/lib-sourcify/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ import { EtherscanUtils } from '@ethereum-sourcify/lib-sourcify';
512512
const etherscanResult = await EtherscanUtils.fetchFromEtherscan(
513513
1, // chainId
514514
'0x6B175474E89094C44Da98b954EedeAC495271d0F', // contract address
515-
'YOUR_API_KEY', // optional API key
515+
'YOUR_API_KEY', // API key
516516
);
517517
```
518518

packages/lib-sourcify/src/utils/etherscan/etherscan-util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,13 @@ export const getVyperJsonInputFromSingleFileResult = (
176176
export const fetchFromEtherscan = async (
177177
chainId: number | string,
178178
address: string,
179-
apiKey: string = '',
179+
apiKey: string,
180180
): Promise<EtherscanResult> => {
181181
const url = `https://api.etherscan.io/v2/api?chainid=${chainId}&module=contract&action=getsourcecode&address=${address}&apikey=`;
182182
const secretUrl = url + apiKey;
183183
const maskedUrl = url + (apiKey ? apiKey.slice(0, 6) + '...' : '');
184184

185-
let response: any;
185+
let response: Response;
186186
logInfo('Fetching from Etherscan', {
187187
maskedUrl,
188188
chainId,

packages/lib-sourcify/test/utils/etherscan-util.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe('etherscan util (lib)', function () {
4343
const testChainId = 1;
4444
const testAddress = '0xB753548F6E010e7e680BA186F9Ca1BdAB2E90cf2';
4545
const sourcifyChain = makeChain(testChainId);
46+
const testApiKey = '';
4647

4748
this.afterEach(() => {
4849
nock.cleanAll();
@@ -54,11 +55,11 @@ describe('etherscan util (lib)', function () {
5455
sourcifyChain,
5556
testAddress,
5657
UNVERIFIED_CONTRACT_RESPONSE,
57-
'',
58+
testApiKey,
5859
);
5960

6061
const error = await expect(
61-
EtherscanUtils.fetchFromEtherscan(testChainId, testAddress),
62+
EtherscanUtils.fetchFromEtherscan(testChainId, testAddress, testApiKey),
6263
).to.be.rejectedWith(EtherscanImportError);
6364
expect((error as any).code).to.equal('etherscan_not_verified');
6465
expect(scope.isDone()).to.equal(true);
@@ -69,11 +70,11 @@ describe('etherscan util (lib)', function () {
6970
sourcifyChain,
7071
testAddress,
7172
INVALID_API_KEY_RESPONSE,
72-
'',
73+
testApiKey,
7374
);
7475

7576
const error = await expect(
76-
EtherscanUtils.fetchFromEtherscan(testChainId, testAddress),
77+
EtherscanUtils.fetchFromEtherscan(testChainId, testAddress, testApiKey),
7778
).to.be.rejectedWith(EtherscanImportError);
7879
expect((error as any).code).to.equal('etherscan_api_error');
7980
expect(scope.isDone()).to.equal(true);
@@ -84,11 +85,11 @@ describe('etherscan util (lib)', function () {
8485
sourcifyChain,
8586
testAddress,
8687
RATE_LIMIT_REACHED_RESPONSE,
87-
'',
88+
testApiKey,
8889
);
8990

9091
const error = await expect(
91-
EtherscanUtils.fetchFromEtherscan(testChainId, testAddress),
92+
EtherscanUtils.fetchFromEtherscan(testChainId, testAddress, testApiKey),
9293
).to.be.rejectedWith(EtherscanImportError);
9394
expect((error as any).code).to.equal('etherscan_rate_limit');
9495
expect(scope.isDone()).to.equal(true);
@@ -111,6 +112,7 @@ describe('etherscan util (lib)', function () {
111112
const result = await EtherscanUtils.fetchFromEtherscan(
112113
testChainId,
113114
testAddress,
115+
testApiKey,
114116
);
115117
expect(result).to.deep.equal((response as any).result[0]);
116118
expect(scope.isDone()).to.equal(true);

services/server/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
"@ethereum-sourcify/lib-sourcify": "^2.2.2",
5656
"@google-cloud/cloud-sql-connector": "1.8.2",
5757
"@shazow/whatsabi": "0.22.2",
58-
"@solidity-parser/parser": "0.20.2",
5958
"abitype": "1.0.8",
6059
"bunyan": "1.8.15",
6160
"chalk": "4.1.2",

0 commit comments

Comments
 (0)