@@ -710,33 +710,34 @@ async function processInitForm(
710
710
return address ;
711
711
}
712
712
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
730
714
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 ) ,
738
720
) ;
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
+ }
740
741
} else {
741
742
abiFromApi = initAbi ;
742
743
}
@@ -745,7 +746,7 @@ async function processInitForm(
745
746
if ( ! initStartBlock ) {
746
747
startBlock = await retryWithPrompt ( ( ) =>
747
748
withSpinner (
748
- 'Fetching start block from contract API...' ,
749
+ 'Fetching start block from Contract API...' ,
749
750
'Failed to fetch start block' ,
750
751
'Warning fetching start block' ,
751
752
( ) => contractService . getStartBlock ( network . id , address ) ,
@@ -758,7 +759,7 @@ async function processInitForm(
758
759
if ( ! initContractName ) {
759
760
contractName = await retryWithPrompt ( ( ) =>
760
761
withSpinner (
761
- 'Fetching contract name from contract API...' ,
762
+ 'Fetching contract name from Contract API...' ,
762
763
'Failed to fetch contract name' ,
763
764
'Warning fetching contract name' ,
764
765
( ) => contractService . getContractName ( network . id , address ) ,
0 commit comments