fix comments

pull/5370/head
yann300 5 years ago
parent c89f156352
commit 3ad3339be5
  1. 7
      apps/remix-ide/src/app/tabs/network-module.js
  2. 9
      apps/remix-ide/src/app/tabs/runTab/settings.js
  3. 25
      apps/remix-ide/src/app/udapp/run-tab.js

@ -61,11 +61,8 @@ export class NetworkModule extends Plugin {
/** Add a custom network to the list of available networks */ /** Add a custom network to the list of available networks */
addNetwork (network) { // { name, url } addNetwork (network) { // { name, url }
if (network.url === 'ipc') { const provider = network.url === 'ipc' ? new Web3.providers.IpcProvider() : new Web3.providers.HttpProvider(network.url)
this.blockchain.addProvider({ name: network.name, provider: new Web3.providers.IpcProvider() }) this.blockchain.addProvider({ name: network.name, provider })
} else {
this.blockchain.addProvider({ name: network.name, provider: new Web3.providers.HttpProvider(network.url) })
}
} }
/** Remove a network to the list of availble networks */ /** Remove a network to the list of availble networks */

@ -158,13 +158,13 @@ class SettingsUI {
const addProvider = (network) => { const addProvider = (network) => {
selectExEnv.appendChild(yo`<option selectExEnv.appendChild(yo`<option
title="Manually added environment: ${network.url}" title="provider name: ${network.name}"
value="${network.name}" value="${network.name}"
name="executionContext" name="executionContext"
> >
${network.name} ${network.name}
</option>`) </option>`)
addTooltip(yo`<span><b>${network.name}</b> provider added ${network.url ? `- ${network.url}` : ''}</span>`) addTooltip(yo`<span><b>${network.name}</b> provider added</span>`)
} }
const removeProvider = (name) => { const removeProvider = (name) => {
@ -243,7 +243,10 @@ class SettingsUI {
this.onPersonalChange() this.onPersonalChange()
} }
break break
default: default: {
plusBtn.classList.add(css.disableMouseEvents)
plusTitle.title = `Unfortunately it's not possible to create an account using an external wallet (${this.selectExEnv.value}).`
}
} }
} }

@ -202,27 +202,28 @@ export class RunTab extends LibraryPlugin {
this.renderRecorder(this.udappUI, this.fileManager, this.config, this.logCallback) this.renderRecorder(this.udappUI, this.fileManager, this.config, this.logCallback)
this.renderRecorderCard() this.renderRecorderCard()
this.on('manager', 'pluginDeactivated', profile => { const addPluginProvider = (profile) => {
if (profile.kind === 'provider') this.blockchain.removeProvider(profile.name)
})
this.on('manager', 'pluginActivated', profile => {
if (profile.kind === 'provider') { if (profile.kind === 'provider') {
((profile, app) => { ((profile, app) => {
const web3Provider = { const web3Provider = {
sendAsync (payload, callback) { async sendAsync (payload, callback) {
app.call(profile.name, 'sendAsync', payload) try {
.then(result => { const result = await app.call(profile.name, 'sendAsync', payload)
callback(null, result) callback(null, result)
}) } catch (e) {
.catch(e => {
callback(e) callback(e)
})
} }
} }
this.blockchain.addProvider({ name: profile.displayName, provider: web3Provider }) }
app.blockchain.addProvider({ name: profile.displayName, provider: web3Provider })
})(profile, this) })(profile, this)
} }
}) }
const removePluginProvider = (profile) => {
if (profile.kind === 'provider') this.blockchain.removeProvider(profile.displayName)
}
this.on('manager', 'pluginActivated', addPluginProvider.bind(this))
this.on('manager', 'pluginDeactivated', removePluginProvider.bind(this))
return this.renderContainer() return this.renderContainer()
} }
} }

Loading…
Cancel
Save