|
|
@ -80,12 +80,13 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React. |
|
|
|
{id: 5, name: 'goerli'} |
|
|
|
{id: 5, name: 'goerli'} |
|
|
|
] |
|
|
|
] |
|
|
|
let found = false |
|
|
|
let found = false |
|
|
|
|
|
|
|
let workspaceName = 'etherscan-code-sample' |
|
|
|
let filePath |
|
|
|
let filePath |
|
|
|
const foundOnNetworks = [] |
|
|
|
const foundOnNetworks = [] |
|
|
|
for (const network of networks) { |
|
|
|
for (const network of networks) { |
|
|
|
const target = `/${network.name}/${contractAddress}` |
|
|
|
const target = `/${network.name}/${contractAddress}` |
|
|
|
try { |
|
|
|
try { |
|
|
|
data = await fetchContractFromEtherscan(plugin, network, contractAddress, target, etherscanKey) |
|
|
|
data = await fetchContractFromEtherscan(plugin, network, contractAddress, target, false, etherscanKey) |
|
|
|
} catch (error) { |
|
|
|
} catch (error) { |
|
|
|
if ((error.message.startsWith('contract not verified on Etherscan') || error.message.startsWith('unable to retrieve contract data')) && network.id !== 5) |
|
|
|
if ((error.message.startsWith('contract not verified on Etherscan') || error.message.startsWith('unable to retrieve contract data')) && network.id !== 5) |
|
|
|
continue |
|
|
|
continue |
|
|
@ -96,10 +97,10 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React. |
|
|
|
} |
|
|
|
} |
|
|
|
found = true |
|
|
|
found = true |
|
|
|
foundOnNetworks.push(network.name) |
|
|
|
foundOnNetworks.push(network.name) |
|
|
|
if (await workspaceExists('etherscan-code-sample')) workspaceProvider.setWorkspace('etherscan-code-sample') |
|
|
|
if (await workspaceExists(workspaceName)) workspaceProvider.setWorkspace(workspaceName) |
|
|
|
else await createWorkspaceTemplate('etherscan-code-sample', 'code-template') |
|
|
|
else await createWorkspaceTemplate(workspaceName, 'code-template') |
|
|
|
plugin.setWorkspace({ name: 'etherscan-code-sample', isLocalhost: false }) |
|
|
|
plugin.setWorkspace({ name: workspaceName, isLocalhost: false }) |
|
|
|
dispatch(setCurrentWorkspace({ name: 'etherscan-code-sample', isGitRepo: false })) |
|
|
|
dispatch(setCurrentWorkspace({ name: workspaceName, isGitRepo: false })) |
|
|
|
count = count + (Object.keys(data.compilationTargets)).length |
|
|
|
count = count + (Object.keys(data.compilationTargets)).length |
|
|
|
for (filePath in data.compilationTargets) |
|
|
|
for (filePath in data.compilationTargets) |
|
|
|
await workspaceProvider.set(filePath, data.compilationTargets[filePath]['content']) |
|
|
|
await workspaceProvider.set(filePath, data.compilationTargets[filePath]['content']) |
|
|
|