activate source-verifier plugin & try/catch

pull/1/head
yann300 5 years ago
parent d20b1015ae
commit 5d36088dec
  1. 10
      src/app/compiler/compiler-sourceVerifier-fetchAndCompile.js
  2. 5
      src/app/tabs/debugger-tab.js
  3. 2
      src/remixAppManager.js

@ -75,8 +75,14 @@ export default class FetchAndCompile extends Plugin {
let name = network.name.toLowerCase() let name = network.name.toLowerCase()
name === 'main' ? 'mainnet' : name // source-verifier api expect "mainnet" and not "main" name === 'main' ? 'mainnet' : name // source-verifier api expect "mainnet" and not "main"
await this.call('manager', 'activatePlugin', 'source-verification') let data
const data = await this.call('source-verification', 'fetch', contractAddress, name.toLowerCase()) try {
data = await this.call('source-verification', 'fetch', contractAddress, name.toLowerCase())
} catch (e) {
setTimeout(_ => this.emit('sourceVerificationNotAvailable'), 0)
this.unresolvedAddresses.push(contractAddress)
return localCompilation()
}
if (!data || !data.metadata) { if (!data || !data.metadata) {
setTimeout(_ => this.emit('notFound', contractAddress), 0) setTimeout(_ => this.emit('notFound', contractAddress), 0)
this.unresolvedAddresses.push(contractAddress) this.unresolvedAddresses.push(contractAddress)

@ -50,11 +50,16 @@ class DebuggerTab extends ViewPlugin {
toaster(yo`<div><b>Using compilation result from Solidity module</b></div>`) toaster(yo`<div><b>Using compilation result from Solidity module</b></div>`)
}) })
this.on('fetchAndCompile', 'sourceVerificationNotAvailable', () => {
toaster(yo`<div><b>Source verification plugin not activated or not available.</b> continuing <i>without</i> source code debugging.</div>`)
})
this.debuggerUI = new DebuggerUI( this.debuggerUI = new DebuggerUI(
this.el.querySelector('#debugger'), this.el.querySelector('#debugger'),
this.blockchain, this.blockchain,
adddress => this.call('fetchAndCompile', 'resolve', adddress, '.debug', this.blockchain.web3())) adddress => this.call('fetchAndCompile', 'resolve', adddress, '.debug', this.blockchain.web3()))
this.call('manager', 'activatePlugin', 'source-verification')
// this.call('manager', 'activatePlugin', 'udapp') // this.call('manager', 'activatePlugin', 'udapp')
return this.el return this.el

@ -15,7 +15,7 @@ export function isNative (name) {
} }
export function canActivate (name) { export function canActivate (name) {
return ['manager'].includes(name) return ['manager', 'debugger'].includes(name)
} }
export class RemixAppManager extends PluginManager { export class RemixAppManager extends PluginManager {

Loading…
Cancel
Save