@@ -552,25 +552,25 @@ export const clearInstances = () => {
552552}
553553
554554export const loadAddress = ( contract : ContractData , address : string ) => {
555- if ( ! contract ) return dispatch ( displayPopUp ( 'No compiled contracts found.' ) )
556555 loadContractFromAddress ( address ,
557- ( cb ) => {
558- dispatch ( displayNotification ( 'At Address' , `Do you really want to interact with ${ address } using the current ABI definition?` , 'OK' , 'Cancel' , cb , null ) )
559- } ,
560- ( error , loadType , abi ) => {
561- if ( error ) {
562- return dispatch ( displayNotification ( 'Alert' , error , 'OK' , null ) )
563- }
564- const compiler = plugin . REACT_API . contracts . contractList . find ( item => item . alias === contract . name )
565- const contractData = getSelectedContract ( contract . name , compiler . name )
566-
567- if ( loadType === 'abi' ) {
568- return addInstance ( { contractData, address, name : '<at address>' } )
569- }
570- addInstance ( { contractData, address, name : contract . name } )
571- }
572- )
573- }
556+ ( cb ) => {
557+ dispatch ( displayNotification ( 'At Address' , `Do you really want to interact with ${ address } using the current ABI definition?` , 'OK' , 'Cancel' , cb , null ) )
558+ } ,
559+ ( error , loadType , abi ) => {
560+ if ( error ) {
561+ return dispatch ( displayNotification ( 'Alert' , error , 'OK' , null ) )
562+ }
563+ if ( loadType === 'abi' ) {
564+ return addInstance ( { abi, address, name : '<at address>' } )
565+ } else if ( loadType === 'instance' ) {
566+ if ( ! contract ) return dispatch ( displayPopUp ( 'No compiled contracts found.' ) )
567+ const compiler = plugin . REACT_API . contracts . contractList . find ( item => item . alias === contract . name )
568+ const contractData = getSelectedContract ( contract . name , compiler . name )
569+ return addInstance ( { contractData, address, name : contract . name } )
570+ }
571+ }
572+ )
573+ }
574574
575575export const getContext = ( ) => {
576576 return plugin . blockchain . context ( )
0 commit comments