Udapp as a LibrayPlugin in RunTab.

pull/3094/head
Grandschtroumpf 5 years ago committed by François
parent a4fe35f60c
commit 9e8112cba0
  1. 6972
      package-lock.json
  2. 8
      package.json
  3. 21
      src/app.js
  4. 1
      src/app/components/panel.js
  5. 4
      src/app/components/vertical-icons.js
  6. 6
      src/app/panels/terminal.js
  7. 2
      src/app/tabs/compile-tab.js
  8. 2
      src/app/udapp/index.js
  9. 8
      src/app/udapp/make-udapp.js
  10. 66
      src/app/udapp/run-tab.js
  11. 6
      src/app/ui/landing-page/landing-page.js
  12. 6
      src/app/ui/landing-page/workspace.js
  13. 16
      src/remixAppManager.js
  14. 383
      src/universal-dapp.js
  15. 2
      test-browser/commands/addAtAddressInstance.js
  16. 2
      test-browser/commands/addFile.js
  17. 2
      test-browser/commands/createContract.js
  18. 2
      test-browser/commands/selectContract.js
  19. 4
      test-browser/tests/ballot.js
  20. 2
      test-browser/tests/recorder.js
  21. 2
      test-browser/tests/signingMessage.js
  22. 6
      test-browser/tests/transactionExecution.js

6972
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -51,7 +51,7 @@
"onchange": "^3.2.1",
"remix-analyzer": "0.3.8",
"remix-debug": "0.3.9",
"remix-lib": "0.4.7",
"remix-lib": "^0.4.8",
"remix-solidity": "0.3.10",
"remix-tabs": "1.0.48",
"remix-tests": "0.1.13",
@ -61,7 +61,6 @@
"selenium-standalone": "^6.0.1",
"semver": "^6.1.2",
"solc": "^0.5.0",
"standard": "^8.5.0",
"swarmgw": "^0.3.1",
"tape": "^4.5.1",
"uglify-js": "^2.8.16",
@ -73,9 +72,10 @@
"yo-yoify": "^3.7.3"
},
"dependencies": {
"@remixproject/engine": "^0.1.5",
"http-server": "^0.11.1",
"@remixproject/engine": "^0.1.2-7",
"remixd": "0.1.8-alpha.6"
"remixd": "0.1.8-alpha.6",
"standard": "^8.5.0"
},
"repository": {
"type": "git",

@ -11,7 +11,6 @@ var loadFileFromParent = require('./loadFilesFromParent')
var { OffsetToLineColumnConverter } = require('./lib/offsetToLineColumnConverter')
var QueryParams = require('./lib/query-params')
var GistHandler = require('./lib/gist-handler')
var makeUdapp = require('./makeUdapp')
var Storage = remixLib.Storage
var Browserfiles = require('./app/files/browser-files')
var SharedFolder = require('./app/files/shared-folder')
@ -34,10 +33,11 @@ const SettingsTab = require('./app/tabs/settings-tab')
const AnalysisTab = require('./app/tabs/analysis-tab')
const DebuggerTab = require('./app/tabs/debugger-tab')
const TestTab = require('./app/tabs/test-tab')
const RunTab = require('./app/tabs/run-tab')
const FilePanel = require('./app/panels/file-panel')
const Editor = require('./app/editor/editor')
import { RunTab, makeUdapp } from './app/udapp';
import PanelsResize from './lib/panels-resize'
import { RemixAppManager } from './remixAppManager'
import { FramingService } from './framingService'
@ -49,6 +49,7 @@ import { HiddenPanel } from './app/components/hidden-panel'
import { VerticalIcons } from './app/components/vertical-icons'
import { LandingPage } from './app/ui/landing-page/landing-page'
import { MainPanel } from './app/components/main-panel'
import { UniversalDApp } from 'remix-lib'
var css = csjs`
html { box-sizing: border-box; }
@ -244,7 +245,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const compilersArtefacts = new CompilersArtefacts() // store all the compilation results (key represent a compiler name)
registry.put({api: compilersArtefacts, name: 'compilersartefacts'})
// ----------------- universal dapp: run transaction, listen on transactions, decode events
const {udapp, eventsDecoder, txlistener} = makeUdapp(compilersArtefacts, (domEl) => mainview.getTerminal().logHtml(domEl))
const udapp = new UniversalDApp(registry.get('config').api)
const {eventsDecoder, txlistener} = makeUdapp(udapp, compilersArtefacts, (domEl) => mainview.getTerminal().logHtml(domEl))
// ----------------- network service (resolve network id / name) ----------------------------
const networkModule = new NetworkModule()
// ----------------- convert offset to line/column service ----------------------------
@ -258,7 +260,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
fileManager,
compilerMetadataGenerator,
compilersArtefacts,
udapp,
networkModule,
offsetToLineColumnConverter
])
@ -301,7 +302,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
])
// CONTENT VIEWS & DEFAULT PLUGINS
let compileTab = new CompileTab(
const compileTab = new CompileTab(
editor,
registry.get('config').api,
new Renderer(),
@ -309,7 +310,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
registry.get('filemanager').api,
registry.get('fileproviders').api,
)
let run = new RunTab(
const run = new RunTab(
udapp,
registry.get('config').api,
registry.get('filemanager').api,
@ -319,9 +320,9 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
networkModule,
mainview
)
let analysis = new AnalysisTab(registry)
let debug = new DebuggerTab()
let test = new TestTab(
const analysis = new AnalysisTab(registry)
const debug = new DebuggerTab()
const test = new TestTab(
registry.get('filemanager').api,
filePanel,
compileTab,
@ -338,7 +339,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
...appManager.registeredPlugins()
])
await appManager.activate(['contentImport', 'theme', 'sourceHighlighters', 'fileManager', 'compilerMetadata', 'compilerArtefacts', 'udapp', 'network', 'offsetToLineColumnConverter'])
await appManager.activate(['contentImport', 'theme', 'sourceHighlighters', 'fileManager', 'compilerMetadata', 'compilerArtefacts', 'network', 'offsetToLineColumnConverter'])
await appManager.activate(['mainPanel'])
await appManager.activate(['menuicons', 'home', 'sidePanel', 'pluginManager', 'fileExplorers', 'settings'])

@ -44,7 +44,6 @@ export class AbstractPanel extends HostPlugin {
* @param {HTMLElement} content the HTMLContent of the plugin
*/
add (view, name) {
console.log('panel', name, view)
if (this.contents[name]) throw new Error(`Plugin ${name} already rendered`)
view.style.height = '100%'
view.style.width = '100%'

@ -310,7 +310,7 @@ export class VerticalIcons extends Plugin {
</div>
`
this.iconKind['run'] = yo`
this.iconKind['udapp'] = yo`
<div id='runIcons'>
</div>
`
@ -345,7 +345,7 @@ export class VerticalIcons extends Plugin {
${home}
${this.iconKind['fileexplorer']}
${this.iconKind['compile']}
${this.iconKind['run']}
${this.iconKind['udapp']}
${this.iconKind['testing']}
${this.iconKind['analysis']}
${this.iconKind['debugging']}

@ -199,7 +199,11 @@ class Terminal extends Plugin {
</div>
`
setInterval(async () => {
self._view.pendingTxCount.innerHTML = await self.call('udapp', 'pendingTransactionsCount')
try {
self._view.pendingTxCount.innerHTML = await self.call('udapp', 'pendingTransactionsCount')
} catch {
console.log('Terminal try to call "udapp".')
}
}, 1000)
function listenOnNetwork (ev) {

@ -30,7 +30,7 @@ const profile = {
location: 'sidePanel',
documentation: 'https://remix-ide.readthedocs.io/en/latest/solidity_editor.html',
version: packageJson.version,
methods: ['getCompilationResult']
methods: ['getCompilationResult', 'compile']
}

@ -0,0 +1,2 @@
export * from './run-tab'
export * from './make-udapp'

@ -1,15 +1,13 @@
var UniversalDApp = require('./universal-dapp.js')
var registry = require('./global/registry')
var registry = require('../../global/registry')
var remixLib = require('remix-lib')
var yo = require('yo-yo')
var executionContext = remixLib.execution.executionContext
var Txlistener = remixLib.execution.txListener
var EventsDecoder = remixLib.execution.EventsDecoder
var TransactionReceiptResolver = require('./lib/transactionReceiptResolver')
var TransactionReceiptResolver = require('../../lib/transactionReceiptResolver')
module.exports = (compilersArtefacts, logHtmlCallback) => {
export function makeUdapp(udapp, compilersArtefacts, logHtmlCallback) {
// ----------------- UniversalDApp -----------------
const udapp = new UniversalDApp(registry)
// TODO: to remove when possible
udapp.event.register('transactionBroadcasted', (txhash, networkName) => {
var txLink = executionContext.txDetailsLink(networkName, txhash)

@ -1,41 +1,40 @@
var $ = require('jquery')
var yo = require('yo-yo')
var EventManager = require('../../lib/events')
var Card = require('../ui/card')
var css = require('./styles/run-tab-styles')
var Settings = require('./runTab/model/settings.js')
var SettingsUI = require('./runTab/settings.js')
import { LibraryPlugin } from '@remixproject/engine';
import * as packageJson from '../../../package.json'
var DropdownLogic = require('./runTab/model/dropdownlogic.js')
var ContractDropdownUI = require('./runTab/contractDropdown.js')
var UniversalDAppUI = require('../ui/universal-dapp-ui')
const $ = require('jquery')
const yo = require('yo-yo')
const EventManager = require('../../lib/events')
const Card = require('../ui/card')
var Recorder = require('./runTab/model/recorder.js')
var RecorderUI = require('./runTab/recorder.js')
const css = require('../tabs/styles/run-tab-styles')
const Settings = require('../tabs/runTab/model/settings.js')
const SettingsUI = require('../tabs/runTab/settings.js')
const Recorder = require('../tabs/runTab/model/recorder.js')
const RecorderUI = require('../tabs/runTab/recorder.js')
const DropdownLogic = require('../tabs/runTab/model/dropdownlogic.js')
const ContractDropdownUI = require('../tabs/runTab/contractDropdown.js')
const UniversalDAppUI = require('../ui/universal-dapp-ui')
const executionContext = require('../../execution-context')
import { ViewPlugin } from '@remixproject/engine'
import * as packageJson from '../../../package.json'
const profile = {
name: 'run',
name: 'udapp',
displayName: 'Deploy & run transactions',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNi4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzFfY29weSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4Ig0KCSB5PSIwcHgiIHdpZHRoPSI3NDIuNTQ1cHgiIGhlaWdodD0iNjc2Ljg4NnB4IiB2aWV3Qm94PSIwIC0wLjIwNCA3NDIuNTQ1IDY3Ni44ODYiDQoJIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAtMC4yMDQgNzQyLjU0NSA2NzYuODg2IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KCTxwb2x5Z29uIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBwb2ludHM9IjI5NS45MTEsMC43MTEgNDg4LjkxMSwzMDQuMTg2IDQ4OC45MTEsMzk3LjE4MSAyOTMuOTExLDY3Ni41NTYgDQoJCTc0MS43ODYsMzQ5Ljk0MyAJIi8+DQoJPHBvbHlnb24gc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHBvaW50cz0iNDE3LjA4Myw0MDYuNTg5IDIwOS43OTEsNTE5LjQ5NCAxLjg0Niw0MDYuMjM0IDIwOS43OTEsNjc1Ljg2MyAJIi8+DQoJPHBvbHlnb24gc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHBvaW50cz0iNDE3LjA4MywzMTguNzA3IDIwOS43OTEsMC43MTEgMS44NDYsMzE4LjQyOCAyMDkuNzkxLDQzMS42ODkgCSIvPg0KPC9nPg0KPC9zdmc+DQo=',
description: 'execute and save transactions',
kind: 'run',
kind: 'udapp',
location: 'sidePanel',
documentation: 'https://remix-ide.readthedocs.io/en/latest/run.html',
version: packageJson.version
version: packageJson.version,
permission: true,
events: ['newTransaction'],
methods: ['createVMAccount', 'sendTransaction', 'getAccounts', 'pendingTransactionsCount']
}
class RunTab extends ViewPlugin {
export class RunTab extends LibraryPlugin {
constructor (udapp, config, fileManager, editor, filePanel, compilersArtefacts, networkModule, mainView) {
super(profile)
super(udapp, profile)
this.event = new EventManager()
this.config = config
this.udapp = udapp
@ -55,11 +54,11 @@ class RunTab extends ViewPlugin {
},
getValue: (cb) => {
try {
var number = document.querySelector('#value').value
var select = document.getElementById('unit')
var index = select.selectedIndex
var selectedUnit = select.querySelectorAll('option')[index].dataset.unit
var unit = 'ether' // default
const number = document.querySelector('#value').value
const select = document.getElementById('unit')
const index = select.selectedIndex
const selectedUnit = select.querySelectorAll('option')[index].dataset.unit
let unit = 'ether' // default
if (['ether', 'finney', 'gwei', 'wei'].indexOf(selectedUnit) >= 0) {
unit = selectedUnit
}
@ -126,11 +125,11 @@ class RunTab extends ViewPlugin {
}
renderDropdown (udappUI, fileManager, compilersArtefacts, config, editor, udapp, filePanel, logCallback) {
var dropdownLogic = new DropdownLogic(fileManager, compilersArtefacts, config, editor, udapp, filePanel, this)
const dropdownLogic = new DropdownLogic(fileManager, compilersArtefacts, config, editor, udapp, filePanel, this)
this.contractDropdownUI = new ContractDropdownUI(dropdownLogic, logCallback)
this.contractDropdownUI.event.register('clearInstance', () => {
var noInstancesText = this.noInstancesText
const noInstancesText = this.noInstancesText
if (noInstancesText.parentNode) { noInstancesText.parentNode.removeChild(noInstancesText) }
})
this.contractDropdownUI.event.register('newContractABIAdded', (abi, address) => {
@ -144,7 +143,7 @@ class RunTab extends ViewPlugin {
renderRecorder (udapp, udappUI, fileManager, config, logCallback) {
this.recorderCount = yo`<span>0</span>`
var recorder = new Recorder(udapp, fileManager, config)
const recorder = new Recorder(udapp, fileManager, config)
recorder.event.register('recorderCountChange', (count) => {
this.recorderCount.innerText = count
})
@ -206,7 +205,4 @@ class RunTab extends ViewPlugin {
this.renderRecorderCard()
return this.renderContainer()
}
}
module.exports = RunTab
}

@ -125,21 +125,21 @@ export class LandingPage extends ViewPlugin {
let startSolidity = () => {
this.appManager.ensureActivated('solidity')
this.appManager.ensureActivated('run')
this.appManager.ensureActivated('udapp')
this.appManager.ensureActivated('solidityStaticAnalysis')
this.appManager.ensureActivated('solidityUnitTesting')
this.verticalIcons.select('solidity')
}
let startVyper = () => {
this.appManager.ensureActivated('vyper')
this.appManager.ensureActivated('run')
this.appManager.ensureActivated('udapp')
this.verticalIcons.select('vyper')
}
let startPipeline = () => {
this.appManager.ensureActivated('solidity')
this.appManager.ensureActivated('pipeline')
this.appManager.ensureActivated('run')
this.appManager.ensureActivated('udapp')
}
let startDebugger = () => {
this.appManager.ensureActivated('debugger')

@ -16,7 +16,7 @@ export const defaultWorkspaces = (appManager) => {
true,
() => {
appManager.ensureActivated('solidity')
appManager.ensureActivated('run')
appManager.ensureActivated('udapp')
appManager.ensureActivated('solidityStaticAnalysis')
appManager.ensureActivated('solidityUnitTesting')
}, () => {}),
@ -26,7 +26,7 @@ export const defaultWorkspaces = (appManager) => {
true,
() => {
appManager.ensureActivated('vyper')
appManager.ensureActivated('run')
appManager.ensureActivated('udapp')
}, () => {}),
new Workspace('Debugger', 'Debug transactions with remix', false, () => {
appManager.ensureActivated('debugger')
@ -34,7 +34,7 @@ export const defaultWorkspaces = (appManager) => {
new Workspace('Pipeline', '', false, () => {
appManager.ensureActivated('solidity')
appManager.ensureActivated('pipeline')
appManager.ensureActivated('run')
appManager.ensureActivated('udapp')
})
]
}

@ -4,7 +4,7 @@ import { EventEmitter } from 'events'
import { PermissionHandler } from './app/ui/persmission-handler'
const requiredModules = [ // services + layout views + system views
'compilerArtefacts', 'compilerMetadata', 'contextualListener', 'sourceHighlighters', 'offsetToLineColumnConverter', 'network', 'theme', 'fileManager', 'contentImport', 'udapp',
'compilerArtefacts', 'compilerMetadata', 'contextualListener', 'sourceHighlighters', 'offsetToLineColumnConverter', 'network', 'theme', 'fileManager', 'contentImport',
'mainPanel', 'hiddenPanel', 'sidePanel', 'menuicons', 'fileExplorers',
'terminal', 'home', 'settings', 'pluginManager']
@ -36,7 +36,7 @@ export class RemixAppManager extends PluginEngine {
return Object.keys(this.registered)
}
onDeactivation (plugin) {
onDeactivated (plugin) {
localStorage.setItem('workspace', JSON.stringify(this.actives))
this.event.emit('deactivate', plugin.name)
}
@ -69,7 +69,7 @@ export class RemixAppManager extends PluginEngine {
}
registeredPlugins () {
let vyper = {
const vyper = {
name: 'vyper',
displayName: 'Vyper',
events: ['compilationFinished'],
@ -83,7 +83,7 @@ export class RemixAppManager extends PluginEngine {
icon: 'data:image/svg+xml;base64,PHN2ZyBpZD0iRmxhdF9Mb2dvIiBkYXRhLW5hbWU9IkZsYXQgTG9nbyIgeG1sbnM9Imh0dHA6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MCIgc3R5bGU9ImZpbGw6I2IyYjJiMiIvPjwvc3ZnPg==',
location: 'sidePanel'
}
var pipeline = {
const pipeline = {
name: 'pipeline',
displayName: 'Pipeline',
events: [],
@ -96,7 +96,7 @@ export class RemixAppManager extends PluginEngine {
icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAAAAACIM/FCAAAJU0lEQVR42u3ce1QUVRgA8EEemgoWvjkltIZlIJhCmmTmqVBJJSofaaWpYUUn08wHmkfR6GFWqKh51CDzLZkPKs2MNAkFVAgxw007WZklaWqsLutt0b13LusM7LDfN+x07vcXe3dmvvkxszN35rszEvmfhCQgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgHgspXbcsdVoybKQsXrPfqivk0qoBJqSImV+uG6Tyq34mxOi+7oI+EMt4E3L0P60H5PRjJvSIOYwPsejgsO9ev6FDXjXpEgMvIUM2mXSKibgQWz+9IJ3OoEJWcbtx+t4yM2gcK8jk/k9TUSHyefClUjNClM0NpQnCLiJCfmCOJDNSLGQpNiJCVgQ1b+YfcFPrdt1KsSDmwSFtAgP8AwLbjMeCVGYOu1FyRPvEfBzG4WlRXo4cfvGv/4sByYmQ+Gg8/hiC4/1W1ZIEZbgNWb62+ueKV/0kp+i2FZqR19/LOcnQ392EJEpdc7iP1u7S9XHDZlhH4a0KSW7+xV2IJD28hW2PxyWlaLEF0pEbrpgk6qTbEEnq8uW1TyMl5QiE/MmHqyTpesl9iH2rVB3NCyS1GAHnmKua5C0IiH2rZFdGqOaQ1kM58puo5vA/DQKxb1v5zzZPb8zb+XpnuSEGCjJWXqZpXPa+7EkmuWEyEESO4Y4z1AYf1vQpEOQGtsQZtmsd7VT5nHW+zpATCUqO/uxnt9qXts2EcexiSeRe71TWllU3iC2zZwMlxy1cjyGZNibAQF6jy+vDrUgf2jivTpC9d6n86DrlyROdpo0dYSCD6PKWc2vyFW0cXQdI5cvqhygp7JMrdLrmjqYmMJBuNMXxaqvniPvrABki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OHYI5feniaIEI8ohoJAKmL0Kk8PJ6gQ/QYMFCJDPGAIBxDk4mg9HBMJOqT+hzlBQcjl97AHnq0hRA9IfQ8FBIQQ29fJWIMzZxcRoh+kKuptuCw0xNNCQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQATEY+M/DV/rjLxphEwAAAAASUVORK5CYII=',
location: 'mainPanel'
}
var etherscan = {
const etherscan = {
name: 'etherscan',
displayName: 'Etherscan - Contract verification',
events: [],
@ -109,7 +109,7 @@ export class RemixAppManager extends PluginEngine {
icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHsAAAB7CAYAAABUx/9/AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAAsTAAALEwEAmpwYAAAHBklEQVR42u2dy3WbTBTH/+ikgFEFwZ8K8HQAm6yjDkIHdiogHWBXgDqADgQVaLLJToZ1NtAB38JC0QNJIPGYx73nsIgcHVvz033OnblWVVXQQcqyhBACQgiUZYk0TfHnz5/q79+/rd7PGPsA8I1z/gEAjuOAMQbOOVzX1WKNLFVhCyGQJAnSNEUcx0N/CMu2bXDO4TgOXNcF51y9RauqSomnKApEUQTG2BZANeXDGNsyxuB5HqIoUmYNpf8DoyjC1HBbPEqAl/KPyrJMCg2+V+N930eWZQT72rNer6Ea4FvavtlsCLbGkM+gu66L9XptNuwsy3SG3KjpU5r3ySJrgyCfQfd93wzYmpvs1sBt2x7dtJM2S2DatYJN2nxby8eI2of/BQSzNfQgCNSETWb7PuDL5VIt2IalVL0D55wPwmXW98bKfD7fPj096bFvOtHeVJ7n2/l8DiGEvLteKtazZa+z9xm4EWiDgBNog4ATaIOAE2iDgFMebVBadnfDoWVZlF5N1CTKOcdms+n8xhmBVi8PF0Lg58+fw+fZZErlMeldGxwpIFM8YOvS+UJarUF/W++waWGbNSuKoof6ynpom269NUrme0SfOYQydTHnpNUPwO6zU3QMc06gH1hgyTp6blqam0UVyqkvL02fJ2B7WGfLtu26caR7UYVAK9f0gLe3t+7fzvl8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GiKBZxHO/nRDHG8Pz8fC1YOvKftm1LaXJVibJvBWW+77da315nU1HOPP73zXXd1jcy0H52B1mtVrAsq5IBdN2F0ulGBl0Dpj6f3YJKN8PscEBbq0CbYCoHuaqrZF0/D/lsuX1yo5++5y408tknVa/5fL6VxSdfq5J1vSKLfLb8proxn95sNvf31JkIuOUUXa1AGwd7VztWanJwX6CNgK2KmR4atJawsyxTUoOHBq0N7CiK6u6MSodnCNDKwtYNLhom+Qxx8kT65oUkSSCEwO/fv7FarXSvAFnL5RJhGF5sLXpEpICd5znyPIcQAmVZIk1TJEliWmnPCoLgYrOgUrCTJEGSJAD+TWo3EOjFqlgYhsOPwRrT12rqYx+eYHh40nLQ9TesV0sayHWNe1RlmyqiNhm07/ujabM0qdfUzXpTmOyhDvMrk2fv9ma1hVz3iU29ztSWO7Am910F066ClmUZfN9XdofK9/1JzbWy5dIoilSAjuVyiSiKpF5L5WriMjQd1BrseR6iKJoksr7nUbbhUAiBJEmQpiniOB7lNgMZT4x2+hA6dZfWmyZ1fV0I0bpLtL4Gq4boOM7+GFN9q6/q8j8QmqQtM04gOgAAAABJRU5ErkJggg==',
location: 'sidePanel'
}
var ethdoc = {
const ethdoc = {
name: 'solidityDocMd',
displayName: 'Solidity documentation generator',
events: [],
@ -122,7 +122,7 @@ export class RemixAppManager extends PluginEngine {
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaGVpZ2h0PSIxMDI0IiB3aWR0aD0iMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNOTUwLjE1NCAxOTJINzMuODQ2QzMzLjEyNyAxOTIgMCAyMjUuMTI2OTk5OTk5OTk5OTUgMCAyNjUuODQ2djQ5Mi4zMDhDMCA3OTguODc1IDMzLjEyNyA4MzIgNzMuODQ2IDgzMmg4NzYuMzA4YzQwLjcyMSAwIDczLjg0Ni0zMy4xMjUgNzMuODQ2LTczLjg0NlYyNjUuODQ2QzEwMjQgMjI1LjEyNjk5OTk5OTk5OTk1IDk5MC44NzUgMTkyIDk1MC4xNTQgMTkyek01NzYgNzAzLjg3NUw0NDggNzA0VjUxMmwtOTYgMTIzLjA3N0wyNTYgNTEydjE5MkgxMjhWMzIwaDEyOGw5NiAxMjggOTYtMTI4IDEyOC0wLjEyNVY3MDMuODc1ek03NjcuMDkxIDczNS44NzVMNjA4IDUxMmg5NlYzMjBoMTI4djE5Mmg5Nkw3NjcuMDkxIDczNS44NzV6Ii8+PC9zdmc+',
location: 'sidePanel'
}
var mythx = {
const mythx = {
name: 'remythx',
displayName: 'MythX Security Verification',
events: [],
@ -137,7 +137,7 @@ export class RemixAppManager extends PluginEngine {
location: 'sidePanel',
documentation: 'https://github.com/aquiladev/remix-mythx-plugin/blob/master/README.md'
}
var provable = {
const provable = {
name: 'provable',
displayName: 'Provable - oracle service',
events: [],

@ -1,383 +0,0 @@
var async = require('async')
var ethJSUtil = require('ethereumjs-util')
var BN = ethJSUtil.BN
var remixLib = require('remix-lib')
var crypto = require('crypto')
var TxRunner = remixLib.execution.txRunner
var txHelper = remixLib.execution.txHelper
var EventManager = remixLib.EventManager
var executionContext = remixLib.execution.executionContext
import { Plugin } from '@remixproject/engine'
import { EventEmitter } from 'events'
import * as packageJson from '../package.json'
const profile = {
name: 'udapp',
displayName: 'universal dapp',
description: 'service - run transaction and access account',
permission: true,
version: packageJson.version,
methods: ['createVMAccount', 'newTransaction', 'sendTransaction', 'getAccounts', 'pendingTransactionsCount']
}
module.exports = class UniversalDApp extends Plugin {
constructor (registry) {
super(profile)
this.events = new EventEmitter()
this.event = new EventManager()
this._deps = {
config: registry.get('config').api
}
this._txRunnerAPI = {
config: this._deps.config,
detectNetwork: (cb) => {
executionContext.detectNetwork(cb)
},
personalMode: () => {
return executionContext.getProvider() === 'web3' ? this._deps.config.get('settings/personal-mode') : false
}
}
this.txRunner = new TxRunner({}, this._txRunnerAPI)
this.accounts = {}
executionContext.event.register('contextChanged', this.resetEnvironment.bind(this))
}
// TODO : event should be triggered by Udapp instead of TxListener
/** Listen on New Transaction. (Cannot be done inside constructor because txlistener doesn't exist yet) */
startListening (txlistener) {
txlistener.event.register('newTransaction', (tx) => {
this.events.emit('newTransaction', tx)
})
}
resetEnvironment () {
this.accounts = {}
if (executionContext.isVM()) {
this._addAccount('3cd7232cd6f3fc66a57a6bedc1a8ed6c228fff0a327e169c2bcc5e869ed49511', '0x56BC75E2D63100000')
this._addAccount('2ac6c190b09897cd8987869cc7b918cfea07ee82038d492abce033c75c1b1d0c', '0x56BC75E2D63100000')
this._addAccount('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', '0x56BC75E2D63100000')
this._addAccount('d74aa6d18aa79a05f3473dd030a97d3305737cbc8337d940344345c1f6b72eea', '0x56BC75E2D63100000')
this._addAccount('71975fbf7fe448e004ac7ae54cad0a383c3906055a65468714156a07385e96ce', '0x56BC75E2D63100000')
}
// TODO: most params here can be refactored away in txRunner
this.txRunner = new TxRunner(this.accounts, {
// TODO: only used to check value of doNotShowTransactionConfirmationAgain property
config: this._deps.config,
// TODO: to refactor, TxRunner already has access to executionContext
detectNetwork: (cb) => {
executionContext.detectNetwork(cb)
},
personalMode: () => {
return executionContext.getProvider() === 'web3' ? this._deps.config.get('settings/personal-mode') : false
}
})
this.txRunner.event.register('transactionBroadcasted', (txhash) => {
executionContext.detectNetwork((error, network) => {
if (error || !network) return
this.event.trigger('transactionBroadcasted', [txhash, network.name])
})
})
}
resetAPI (transactionContextAPI) {
this.transactionContextAPI = transactionContextAPI
}
/**
* Create a VM Account
* @param {{privateKey: string, balance: string}} newAccount The new account to create
*/
createVMAccount (newAccount) {
const { privateKey, balance } = newAccount
if (executionContext.getProvider() !== 'vm') {
throw new Error('plugin API does not allow creating a new account through web3 connection. Only vm mode is allowed')
}
this._addAccount(privateKey, balance)
const privKey = Buffer.from(privateKey, 'hex')
return '0x' + ethJSUtil.privateToAddress(privKey).toString('hex')
}
newAccount (password, passwordPromptCb, cb) {
if (!executionContext.isVM()) {
if (!this._deps.config.get('settings/personal-mode')) {
return cb('Not running in personal mode')
}
passwordPromptCb((passphrase) => {
executionContext.web3().personal.newAccount(passphrase, cb)
})
} else {
var privateKey
do {
privateKey = crypto.randomBytes(32)
} while (!ethJSUtil.isValidPrivate(privateKey))
this._addAccount(privateKey, '0x56BC75E2D63100000')
cb(null, '0x' + ethJSUtil.privateToAddress(privateKey).toString('hex'))
}
}
_addAccount (privateKey, balance) {
if (!executionContext.isVM()) {
throw new Error('_addAccount() cannot be called in non-VM mode')
}
if (this.accounts) {
privateKey = Buffer.from(privateKey, 'hex')
const address = ethJSUtil.privateToAddress(privateKey)
// FIXME: we don't care about the callback, but we should still make this proper
let stateManager = executionContext.vm().stateManager
stateManager.getAccount(address, (error, account) => {
if (error) return console.log(error)
account.balance = balance || '0xf00000000000000001'
stateManager.putAccount(address, account, function cb (error) {
if (error) console.log(error)
})
})
this.accounts['0x' + address.toString('hex')] = { privateKey, nonce: 0 }
}
}
getAccounts (cb) {
return new Promise((resolve, reject) => {
const provider = executionContext.getProvider()
switch (provider) {
case 'vm': {
if (!this.accounts) {
if (cb) cb('No accounts?')
reject('No accounts?')
return
}
if (cb) cb(null, Object.keys(this.accounts))
resolve(Object.keys(this.accounts))
}
break
case 'web3': {
if (this._deps.config.get('settings/personal-mode')) {
return executionContext.web3().personal.getListAccounts((error, accounts) => {
if (cb) cb(error, accounts)
if (error) return reject(error)
resolve(accounts)
})
} else {
executionContext.web3().eth.getAccounts((error, accounts) => {
if (cb) cb(error, accounts)
if (error) return reject(error)
resolve(accounts)
})
}
}
break
case 'injected': {
executionContext.web3().eth.getAccounts((error, accounts) => {
if (cb) cb(error, accounts)
if (error) return reject(error)
resolve(accounts)
})
}
}
})
}
getBalance (address, cb) {
address = ethJSUtil.stripHexPrefix(address)
if (!executionContext.isVM()) {
executionContext.web3().eth.getBalance(address, (err, res) => {
if (err) {
cb(err)
} else {
cb(null, res.toString(10))
}
})
} else {
if (!this.accounts) {
return cb('No accounts?')
}
executionContext.vm().stateManager.getAccount(Buffer.from(address, 'hex'), (err, res) => {
if (err) {
cb('Account not found')
} else {
cb(null, new BN(res.balance).toString(10))
}
})
}
}
getBalanceInEther (address, callback) {
this.getBalance(address, (error, balance) => {
if (error) {
callback(error)
} else {
callback(null, executionContext.web3().fromWei(balance, 'ether'))
}
})
}
pendingTransactionsCount () {
return Object.keys(this.txRunner.pendingTxs).length
}
/**
* deploy the given contract
*
* @param {String} data - data to send with the transaction ( return of txFormat.buildData(...) ).
* @param {Function} callback - callback.
*/
createContract (data, confirmationCb, continueCb, promptCb, callback) {
this.runTx({data: data, useCall: false}, confirmationCb, continueCb, promptCb, (error, txResult) => {
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
callback(error, txResult)
})
}
/**
* call the current given contract
*
* @param {String} to - address of the contract to call.
* @param {String} data - data to send with the transaction ( return of txFormat.buildData(...) ).
* @param {Object} funAbi - abi definition of the function to call.
* @param {Function} callback - callback.
*/
callFunction (to, data, funAbi, confirmationCb, continueCb, promptCb, callback) {
this.runTx({to: to, data: data, useCall: funAbi.constant}, confirmationCb, continueCb, promptCb, (error, txResult) => {
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
callback(error, txResult)
})
}
context () {
return (executionContext.isVM() ? 'memory' : 'blockchain')
}
getABI (contract) {
return txHelper.sortAbiFunction(contract.abi)
}
getFallbackInterface (contractABI) {
return txHelper.getFallbackInterface(contractABI)
}
getInputs (funABI) {
if (!funABI.inputs) {
return ''
}
return txHelper.inputParametersDeclarationToString(funABI.inputs)
}
/**
* This function send a tx only to javascript VM or testnet, will return an error for the mainnet
* SHOULD BE TAKEN CAREFULLY!
*
* @param {Object} tx - transaction.
*/
sendTransaction (tx) {
return new Promise((resolve, reject) => {
executionContext.detectNetwork((error, network) => {
if (error) return reject(error)
if (network.name === 'Main' && network.id === '1') {
return reject(new Error('It is not allowed to make this action against mainnet'))
}
this.silentRunTx(tx, (error, result) => {
if (error) return reject(error)
resolve({
transactionHash: result.transactionHash,
status: result.result.status,
gasUsed: '0x' + result.result.gasUsed.toString('hex'),
error: result.result.vm.exceptionError,
return: result.result.vm.return ? '0x' + result.result.vm.return.toString('hex') : '0x',
createdAddress: result.result.createdAddress ? '0x' + result.result.createdAddress.toString('hex') : undefined
})
})
})
})
}
/**
* This function send a tx without alerting the user (if mainnet or if gas estimation too high).
* SHOULD BE TAKEN CAREFULLY!
*
* @param {Object} tx - transaction.
* @param {Function} callback - callback.
*/
silentRunTx (tx, cb) {
if (!executionContext.isVM()) return cb('Cannot silently send transaction through a web3 provider')
this.txRunner.rawRun(
tx,
(network, tx, gasEstimation, continueTxExecution, cancelCb) => { continueTxExecution() },
(error, continueTxExecution, cancelCb) => { if (error) { cb(error) } else { continueTxExecution() } },
(okCb, cancelCb) => { okCb() },
cb
)
}
runTx (args, confirmationCb, continueCb, promptCb, cb) {
const self = this
async.waterfall([
function getGasLimit (next) {
if (self.transactionContextAPI.getGasLimit) {
return self.transactionContextAPI.getGasLimit(next)
}
next(null, 3000000)
},
function queryValue (gasLimit, next) {
if (args.value) {
return next(null, args.value, gasLimit)
}
if (args.useCall || !self.transactionContextAPI.getValue) {
return next(null, 0, gasLimit)
}
self.transactionContextAPI.getValue(function (err, value) {
next(err, value, gasLimit)
})
},
function getAccount (value, gasLimit, next) {
if (args.from) {
return next(null, args.from, value, gasLimit)
}
if (self.transactionContextAPI.getAddress) {
return self.transactionContextAPI.getAddress(function (err, address) {
next(err, address, value, gasLimit)
})
}
self.getAccounts(function (err, accounts) {
let address = accounts[0]
if (err) return next(err)
if (!address) return next('No accounts available')
if (executionContext.isVM() && !self.accounts[address]) {
return next('Invalid account selected')
}
next(null, address, value, gasLimit)
})
},
function runTransaction (fromAddress, value, gasLimit, next) {
var tx = { to: args.to, data: args.data.dataHex, useCall: args.useCall, from: fromAddress, value: value, gasLimit: gasLimit, timestamp: args.data.timestamp }
var payLoad = { funAbi: args.data.funAbi, funArgs: args.data.funArgs, contractBytecode: args.data.contractBytecode, contractName: args.data.contractName, contractABI: args.data.contractABI, linkReferences: args.data.linkReferences }
var timestamp = Date.now()
if (tx.timestamp) {
timestamp = tx.timestamp
}
self.event.trigger('initiatingTransaction', [timestamp, tx, payLoad])
self.txRunner.rawRun(tx, confirmationCb, continueCb, promptCb,
function (error, result) {
let eventName = (tx.useCall ? 'callExecuted' : 'transactionExecuted')
self.event.trigger(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad])
if (error && (typeof (error) !== 'string')) {
if (error.message) error = error.message
else {
try { error = 'error: ' + JSON.stringify(error) } catch (e) {}
}
}
next(error, result)
}
)
}
], cb)
}
}

@ -13,7 +13,7 @@ class addAtAddressInstance extends EventEmitter {
}
function addInstance (browser, address, isValidFormat, isValidChecksum, callback) {
browser.clickLaunchIcon('run').clearValue('.ataddressinput').setValue('.ataddressinput', address, function () {
browser.clickLaunchIcon('udapp').clearValue('.ataddressinput').setValue('.ataddressinput', address, function () {
browser.click('button[id^="runAndDeployAtAdressButton"]')
.execute(function () {
var ret = document.querySelector('div[class^="modal-body"] div').innerHTML

@ -13,7 +13,7 @@ class AddFile extends EventEmitter {
}
function addFile (browser, name, content, done) {
browser.clickLaunchIcon('run').clickLaunchIcon('fileExplorers').click('.newFile')
browser.clickLaunchIcon('udapp').clickLaunchIcon('fileExplorers').click('.newFile')
.perform((client, done) => {
browser.execute(function (fileName) {
if (fileName !== 'Untitled.sol') {

@ -13,7 +13,7 @@ class CreateContract extends EventEmitter {
}
function createContract (browser, inputParams, callback) {
browser.clickLaunchIcon('settings').clickLaunchIcon('run')
browser.clickLaunchIcon('settings').clickLaunchIcon('udapp')
.setValue('div[class^="contractActionsContainerSingle"] input', inputParams, function () {
browser.click('#runTabView button[class^="instanceButton"]').pause(500).perform(function () { callback() })
})

@ -13,7 +13,7 @@ class SelectContract extends EventEmitter {
}
function selectContract (browser, contractName, callback) {
browser.clickLaunchIcon('settings').clickLaunchIcon('run')
browser.clickLaunchIcon('settings').clickLaunchIcon('udapp')
.setValue('#runTabView select[class^="contractNames"]', contractName).perform(() => {
callback()
})

@ -19,7 +19,7 @@ module.exports = {
.waitForElementVisible('#icon-panel', 10000)
.clickLaunchIcon('solidity')
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot'])
.clickLaunchIcon('run')
.clickLaunchIcon('udapp')
.setValue('input[placeholder="uint8 _numProposals"]', '1')
.click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)')
@ -43,7 +43,7 @@ module.exports = {
},
'Access Ballot via at address': function (browser) {
browser.clickLaunchIcon('run')
browser.clickLaunchIcon('udapp')
.click('button[class^="udappClose"]')
.addFile('ballot.abi', { content: ballotABI })
.addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3B', true, false)

@ -12,7 +12,7 @@ module.exports = {
'Test Recorder': function (browser) {
var addressRef
browser.addFile('scenario.json', {content: records})
.clickLaunchIcon('run')
.clickLaunchIcon('udapp')
.click('div[class^="cardContainer"] i[class^="arrow"]')
.click('#runTabView .runtransaction')
.waitForElementPresent('.instance:nth-of-type(2)')

@ -11,7 +11,7 @@ module.exports = {
},
'Test Signature': function (browser) {
let hash, signature
browser.clickLaunchIcon('run').signMessage('test message', (h, s) => {
browser.clickLaunchIcon('udapp').signMessage('test message', (h, s) => {
hash = h
signature = s
console.log('hash', hash)

@ -12,7 +12,7 @@ module.exports = {
'Execute Simple Contract and Test Terminal': function (browser) {
browser.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TestContract'])
.clickLaunchIcon('run')
.clickLaunchIcon('udapp')
.click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2) > div > button')
@ -39,7 +39,7 @@ module.exports = {
'Test Complex Return Values': function (browser) {
browser.testContracts('returnValues.sol', sources[1]['browser/returnValues.sol'], ['testReturnValues'])
.clickLaunchIcon('run')
.clickLaunchIcon('udapp')
.click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2) > div > button')
@ -76,7 +76,7 @@ module.exports = {
'Test Complex Input Values': function (browser) {
browser.testContracts('inputValues.sol', sources[2]['browser/inputValues.sol'], ['test'])
.clickLaunchIcon('run')
.clickLaunchIcon('udapp')
.click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2) > div > button')

Loading…
Cancel
Save