diff --git a/libs/remix-core-plugin/src/lib/compiler-fetch-and-compile.ts b/libs/remix-core-plugin/src/lib/compiler-fetch-and-compile.ts index c6b8ca497e..bf8b87bf55 100644 --- a/libs/remix-core-plugin/src/lib/compiler-fetch-and-compile.ts +++ b/libs/remix-core-plugin/src/lib/compiler-fetch-and-compile.ts @@ -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() diff --git a/libs/remix-core-plugin/src/lib/helpers/fetch-etherscan.ts b/libs/remix-core-plugin/src/lib/helpers/fetch-etherscan.ts index f5f1c71f1b..647547ba47 100644 --- a/libs/remix-core-plugin/src/lib/helpers/fetch-etherscan.ts +++ b/libs/remix-core-plugin/src/lib/helpers/fetch-etherscan.ts @@ -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 diff --git a/libs/remix-core-plugin/src/lib/helpers/fetch-sourcify.ts b/libs/remix-core-plugin/src/lib/helpers/fetch-sourcify.ts index 729b5f14b3..698c062b44 100644 --- a/libs/remix-core-plugin/src/lib/helpers/fetch-sourcify.ts +++ b/libs/remix-core-plugin/src/lib/helpers/fetch-sourcify.ts @@ -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) { diff --git a/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx b/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx index de26b84af9..123a9fec61 100644 --- a/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx @@ -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 }