From 63fdb1b435ad4c4da5a7cb727901066125503f8a Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Tue, 28 Jun 2022 14:08:00 +0530 Subject: [PATCH] toast update --- libs/remix-ui/workspace/src/lib/actions/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/actions/index.ts b/libs/remix-ui/workspace/src/lib/actions/index.ts index 63ffaf3d0b..c1af97d7a6 100644 --- a/libs/remix-ui/workspace/src/lib/actions/index.ts +++ b/libs/remix-ui/workspace/src/lib/actions/index.ts @@ -64,7 +64,7 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React. let route = window.location.pathname if (route.startsWith('/address/0x') && route.length === 51) { const contractAddress = route.split('/')[2] - plugin.call('notification', 'toast', `Looking for contract address ${contractAddress} on different networks`) + plugin.call('notification', 'toast', `Looking for contract(s) verified on different networks of Etherscan for contract address ${contractAddress}`) let data try { let etherscanKey = await plugin.call('config', 'getAppParameter', 'etherscan-access-token') @@ -76,8 +76,8 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React. {id: 42, name: 'kovan'}, {id: 5, name: 'goerli'} ] - plugin.call('notification', 'toast', `Looking for contract address ${contractAddress} on different networks`) let found = false + let foundOnNetworks = [] for (const network of networks) { const target = `/${network.name}/${contractAddress}` try { @@ -91,6 +91,7 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React. } } found = true + foundOnNetworks.push(network.name) await createWorkspaceTemplate('etherscan-code-sample', 'code-template') plugin.setWorkspace({ name: 'etherscan-code-sample', isLocalhost: false }) dispatch(setCurrentWorkspace('etherscan-code-sample')) @@ -98,6 +99,7 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React. await workspaceProvider.set(filePath, data.compilationTargets[filePath]['content']) plugin.on('editor', 'editorMounted', async () => await plugin.fileManager.openFile(filePath)) } + plugin.call('notification', 'toast', `Added contract(s) verified on ${foundOnNetworks.join(',')} networks of Etherscan for contract address ${contractAddress}`) } catch (error) { await basicWorkspaceInit(workspaces, workspaceProvider) }