detect etherscan route

pull/2450/head^2
Aniket-Engg 2 years ago committed by Aniket
parent 6d979660dc
commit cb94a6b81e
  1. 3
      apps/remix-ide/src/app/tabs/theme-module.js
  2. 1
      libs/remix-core-plugin/src/index.ts
  3. 10
      libs/remix-ui/workspace/src/lib/actions/index.ts

@ -37,7 +37,8 @@ export class ThemeModule extends Plugin {
themes.map((theme) => {
this.themes[theme.name.toLocaleLowerCase()] = {
...theme,
url: window.location.origin + window.location.pathname + theme.url
// url: window.location.origin + window.location.pathname + theme.url
url: window.location.origin + '/' + theme.url
}
})
this._paq = _paq

@ -8,3 +8,4 @@ export { GistHandler } from './lib/gist-handler'
export * from './types/contract'
export { LinkLibraries, DeployLibraries } from './lib/link-libraries'
export { OpenZeppelinProxy } from './lib/openzeppelin-proxy'
export { fetchContractFromEtherscan } from './lib/helpers/fetch-etherscan'

@ -6,6 +6,7 @@ import { displayNotification, displayPopUp, fetchDirectoryError, fetchDirectoryR
import { listenOnPluginEvents, listenOnProviderEvents } from './events'
import { createWorkspaceTemplate, getWorkspaces, loadWorkspacePreset, setPlugin } from './workspace'
import { QueryParams } from '@remix-project/remix-lib'
import { fetchContractFromEtherscan } from '@remix-project/core-plugin' // eslint-disable-line
import JSZip from 'jszip'
export * from './events'
@ -31,7 +32,6 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
const localhostProvider = filePanelPlugin.fileProviders.localhost
const params = queryParams.get() as UrlParametersType
const workspaces = await getWorkspaces() || []
dispatch(setWorkspaces(workspaces))
if (params.gist) {
await createWorkspaceTemplate('gist-sample', 'gist-template')
@ -44,7 +44,13 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
dispatch(setCurrentWorkspace('code-sample'))
const filePath = await loadWorkspacePreset('code-template')
plugin.on('editor', 'editorMounted', async () => await plugin.fileManager.openFile(filePath))
} else {
} else if (window.location.pathname && window.location.pathname !== '/') {
const route = window.location.pathname
if (route.startsWith('/address/0x') && route.length === 51) {
console.log('this is an etherscan url')
}
}
else {
if (workspaces.length === 0) {
await createWorkspaceTemplate('default_workspace', 'remixDefault')
plugin.setWorkspace({ name: 'default_workspace', isLocalhost: false })

Loading…
Cancel
Save