better warning msg

pull/5370/head
yann300 3 years ago
parent 6682f39eb3
commit c01ff419c7
  1. 3
      libs/remix-core-plugin/src/lib/compiler-fetch-and-compile.ts
  2. 2
      libs/remix-core-plugin/src/lib/helpers/fetch-etherscan.ts
  3. 2
      libs/remix-core-plugin/src/lib/helpers/fetch-sourcify.ts
  4. 2
      libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx

@ -72,13 +72,16 @@ export class FetchAndCompile extends Plugin {
try {
data = await fetchContractFromSourcify(this, network, contractAddress, targetPath)
} catch (e) {
this.call('notification', 'toast', e.message)
console.log(e) // and fallback to getting the compilation result from etherscan
}
if (!data) {
this.call('notification', 'toast', `contract ${contractAddress} not found in Sourcify, checking in Etherscan..`)
try {
data = await fetchContractFromEtherscan(this, network, contractAddress, targetPath)
} catch (e) {
this.call('notification', 'toast', e.message)
setTimeout(_ => this.emit('notFound', contractAddress), 0) // plugin framework returns a time out error although it actually didn't find the source...
this.unresolvedAddresses.push(contractAddress)
return localCompilation()

@ -16,7 +16,7 @@ export const fetchContractFromEtherscan = async (plugin, network, contractAddres
}
}
} else throw new Error('unable to retrieve contract data ' + data.message)
}
} else throw new Error('unable to try fetching the source code from etherscan: etherscan access token not found. please go to the Remix settings page and provide an access token.')
if (!data || !data.result) {
return null

@ -5,7 +5,7 @@ export const fetchContractFromSourcify = async (plugin, network, contractAddress
try {
data = await plugin.call('sourcify', 'fetchByNetwork', contractAddress, network.id)
} catch (e) {
console.log(e) // and fallback to getting the compilation result from etherscan
console.log(e)
}
if (!data || !data.metadata) {

@ -91,7 +91,7 @@ export const DebuggerUI = (props: DebuggerUIProps) => {
if (!lineColumnPos) {
await debuggerModule.discardHighlight()
setState(prevState => {
return { ...prevState, sourceLocationStatus: 'Source location not available.' }
return { ...prevState, sourceLocationStatus: 'Source location not available, neither in Sourcify nor in Etherscan. Please make sure the etherscan access token is provided in the settings.' }
})
return
}

Loading…
Cancel
Save