Skip to content

Commit ef53d54

Browse files
authored
Merge pull request #2036 from ethereum/fix_load_with_abi
Fix using load from abi
2 parents a86cba0 + 9b4927d commit ef53d54

File tree

1 file changed

+18
-18
lines changed
  • libs/remix-ui/run-tab/src/lib/actions

1 file changed

+18
-18
lines changed

libs/remix-ui/run-tab/src/lib/actions/index.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -552,25 +552,25 @@ export const clearInstances = () => {
552552
}
553553

554554
export 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

575575
export const getContext = () => {
576576
return plugin.blockchain.context()

0 commit comments

Comments
 (0)