File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -42,20 +42,19 @@ export const verifyContract = async (params: VerifyContractParams) => {
4242 return response ;
4343}
4444
45- export const getContractSourceCode = async ( contractAddress : string , chainId : string ) => {
45+ export const getContractSourceCode = async ( contractAddress : string , chainId : string ) : Promise < string | null > => {
4646 const url = `${ ETHERSCAN_V2_API } ?chainid=${ chainId } &module=contract&action=getsourcecode&address=${ contractAddress } &apikey=${ process . env . ETHERSCAN_API_KEY } ` ;
47- console . log ( 'URL' , url ) ;
4847 const response = await fetch ( url , {
4948 method : 'GET' ,
5049 } )
5150 . then ( res => res . json ( ) )
5251 . catch ( console . error ) ;
53- return response . result [ 0 ] . SourceCode ;
52+ return response . result [ 0 ] . SourceCode ?? null ;
5453}
5554
56- export const isContractVerified = async ( contractAddress : string , chainId : string ) => {
55+ export const isContractVerified = async ( contractAddress : string , chainId : string ) : Promise < boolean > => {
5756 const sourceCode = await getContractSourceCode ( contractAddress , chainId ) ;
58- return sourceCode !== null && sourceCode !== undefined ;
57+ return sourceCode !== '' && sourceCode !== null && sourceCode !== undefined ;
5958}
6059
6160/**
You can’t perform that action at this time.
0 commit comments