@@ -710,33 +710,34 @@ async function processInitForm(
710710 return address ;
711711 }
712712
713- const sourcifyContractInfo = await contractService . getFromSourcify (
714- EthereumABI ,
715- network . id ,
716- address ,
717- ) ;
718- if ( sourcifyContractInfo ) {
719- initStartBlock ??= sourcifyContractInfo . startBlock ;
720- initContractName ??= sourcifyContractInfo . name ;
721- initAbi ??= sourcifyContractInfo . abi ;
722- initDebugger . extend ( 'processInitForm' ) (
723- "infoFromSourcify: '%s'/'%s'" ,
724- initStartBlock ,
725- initContractName ,
726- ) ;
727- }
728-
729- // If ABI is not provided, try to fetch it from Etherscan API
713+ // If ABI is not provided, try to fetch it from Sourcify/Etherscan API
730714 if ( protocolInstance . hasABIs ( ) && ! initAbi ) {
731- abiFromApi = await retryWithPrompt ( ( ) =>
732- withSpinner (
733- 'Fetching ABI from contract API...' ,
734- 'Failed to fetch ABI' ,
735- 'Warning fetching ABI' ,
736- ( ) => contractService . getABI ( protocolInstance . getABI ( ) , network . id , address ) ,
737- ) ,
715+ const sourcifyContractInfo = await withSpinner (
716+ 'Fetching ABI from Sourcify API...' ,
717+ 'Failed to fetch ABI' ,
718+ 'Warning fetching ABI' ,
719+ ( ) => contractService . getFromSourcify ( protocolInstance . getABI ( ) , network . id , address ) ,
738720 ) ;
739- initDebugger . extend ( 'processInitForm' ) ( "abiFromEtherscan len: '%s'" , abiFromApi ?. name ) ;
721+ if ( sourcifyContractInfo ) {
722+ initStartBlock ??= sourcifyContractInfo . startBlock ;
723+ initContractName ??= sourcifyContractInfo . name ;
724+ abiFromApi ??= sourcifyContractInfo . abi ;
725+ initDebugger . extend ( 'processInitForm' ) (
726+ "infoFromSourcify: '%s'/'%s'" ,
727+ initStartBlock ,
728+ initContractName ,
729+ ) ;
730+ } else {
731+ abiFromApi = await retryWithPrompt ( ( ) =>
732+ withSpinner (
733+ 'Fetching ABI from Contract API...' ,
734+ 'Failed to fetch ABI' ,
735+ 'Warning fetching ABI' ,
736+ ( ) => contractService . getABI ( protocolInstance . getABI ( ) , network . id , address ) ,
737+ ) ,
738+ ) ;
739+ initDebugger . extend ( 'processInitForm' ) ( "abiFromEtherscan ABI: '%s'" , abiFromApi ?. name ) ;
740+ }
740741 } else {
741742 abiFromApi = initAbi ;
742743 }
@@ -745,7 +746,7 @@ async function processInitForm(
745746 if ( ! initStartBlock ) {
746747 startBlock = await retryWithPrompt ( ( ) =>
747748 withSpinner (
748- 'Fetching start block from contract API...' ,
749+ 'Fetching start block from Contract API...' ,
749750 'Failed to fetch start block' ,
750751 'Warning fetching start block' ,
751752 ( ) => contractService . getStartBlock ( network . id , address ) ,
@@ -758,7 +759,7 @@ async function processInitForm(
758759 if ( ! initContractName ) {
759760 contractName = await retryWithPrompt ( ( ) =>
760761 withSpinner (
761- 'Fetching contract name from contract API...' ,
762+ 'Fetching contract name from Contract API...' ,
762763 'Failed to fetch contract name' ,
763764 'Warning fetching contract name' ,
764765 ( ) => contractService . getContractName ( network . id , address ) ,
0 commit comments