Merge pull request #2036 from ethereum/fix_load_with_abi

Fix using load from abi
pull/2038/head^2
David Disu 3 years ago committed by GitHub
commit ef53d543b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 36
      libs/remix-ui/run-tab/src/lib/actions/index.ts

@ -552,25 +552,25 @@ export const clearInstances = () => {
} }
export const loadAddress = (contract: ContractData, address: string) => { export const loadAddress = (contract: ContractData, address: string) => {
if (!contract) return dispatch(displayPopUp('No compiled contracts found.'))
loadContractFromAddress(address, loadContractFromAddress(address,
(cb) => { (cb) => {
dispatch(displayNotification('At Address', `Do you really want to interact with ${address} using the current ABI definition?`, 'OK', 'Cancel', cb, null)) dispatch(displayNotification('At Address', `Do you really want to interact with ${address} using the current ABI definition?`, 'OK', 'Cancel', cb, null))
}, },
(error, loadType, abi) => { (error, loadType, abi) => {
if (error) { if (error) {
return dispatch(displayNotification('Alert', error, 'OK', null)) return dispatch(displayNotification('Alert', error, 'OK', null))
} }
const compiler = plugin.REACT_API.contracts.contractList.find(item => item.alias === contract.name) if (loadType === 'abi') {
const contractData = getSelectedContract(contract.name, compiler.name) return addInstance({ abi, address, name: '<at address>' })
} else if (loadType === 'instance') {
if (loadType === 'abi') { if (!contract) return dispatch(displayPopUp('No compiled contracts found.'))
return addInstance({ contractData, address, name: '<at address>' }) const compiler = plugin.REACT_API.contracts.contractList.find(item => item.alias === contract.name)
} const contractData = getSelectedContract(contract.name, compiler.name)
addInstance({ contractData, address, name: contract.name }) return addInstance({ contractData, address, name: contract.name })
} }
) }
} )
}
export const getContext = () => { export const getContext = () => {
return plugin.blockchain.context() return plugin.blockchain.context()

Loading…
Cancel
Save