fix comments

pull/178/head
yann300 5 years ago
parent bad90e255b
commit bf665c23fe
  1. 7
      apps/remix-ide/src/app/tabs/network-module.js
  2. 9
      apps/remix-ide/src/app/tabs/runTab/settings.js
  3. 29
      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 */
addNetwork (network) { // { name, url }
if (network.url === 'ipc') {
this.blockchain.addProvider({ name: network.name, provider: new Web3.providers.IpcProvider() })
} else {
this.blockchain.addProvider({ name: network.name, provider: new Web3.providers.HttpProvider(network.url) })
}
const provider = network.url === 'ipc' ? new Web3.providers.IpcProvider() : new Web3.providers.HttpProvider(network.url)
this.blockchain.addProvider({ name: network.name, provider })
}
/** Remove a network to the list of availble networks */

@ -158,13 +158,13 @@ class SettingsUI {
const addProvider = (network) => {
selectExEnv.appendChild(yo`<option
title="Manually added environment: ${network.url}"
title="provider name: ${network.name}"
value="${network.name}"
name="executionContext"
>
${network.name}
</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) => {
@ -243,7 +243,10 @@ class SettingsUI {
this.onPersonalChange()
}
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.renderRecorderCard()
this.on('manager', 'pluginDeactivated', profile => {
if (profile.kind === 'provider') this.blockchain.removeProvider(profile.name)
})
this.on('manager', 'pluginActivated', profile => {
const addPluginProvider = (profile) => {
if (profile.kind === 'provider') {
((profile, app) => {
const web3Provider = {
sendAsync (payload, callback) {
app.call(profile.name, 'sendAsync', payload)
.then(result => {
callback(null, result)
})
.catch(e => {
callback(e)
})
async sendAsync (payload, callback) {
try {
const result = await app.call(profile.name, 'sendAsync', payload)
callback(null, result)
} catch (e) {
callback(e)
}
}
}
this.blockchain.addProvider({ name: profile.displayName, provider: web3Provider })
app.blockchain.addProvider({ name: profile.displayName, provider: web3Provider })
})(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()
}
}

Loading…
Cancel
Save