From c234f40b057d46fffb4bc9dcc5552c7013414c02 Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Thu, 10 May 2018 00:31:45 -0400 Subject: [PATCH] Fixing a recorder --- src/app/tabs/run-tab.js | 15 ++++++++------- src/universal-dapp-styles.js | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index 6eb7104abc..cfda58271b 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -24,13 +24,14 @@ function runTab (appAPI = {}, appEvents = {}, opts = {}) { --------------------------- */ var self = this var event = new EventManager() + appEvents.eventManager = event self._view = {} self.data = { count: 0, text: `All transactions (deployed contracts and function executions) in this environment can be saved and replayed in another environment. i.e. Transactions created in - Javascript VM can be replayed in the Ropsten network.` + Javascript VM can be replayed in the Injected Web3.` } self._view.recorderCount = yo`0` @@ -51,7 +52,7 @@ function runTab (appAPI = {}, appEvents = {}, opts = {}) { ` var container = yo`
` - var recorderInterface = makeRecorder(event, appAPI, appEvents, opts, self) + var recorderInterface = makeRecorder(appAPI, appEvents, opts, self) self._view.collapsedView = yo`
@@ -186,12 +187,12 @@ function updateAccountBalances (container, appAPI) { /* ------------------------------------------------ RECORDER ------------------------------------------------ */ -function makeRecorder (events, appAPI, appEvents, opts, self) { +function makeRecorder (appAPI, appEvents, opts, self) { var recorder = new Recorder(opts.compiler, { events: { udapp: appEvents.udapp, executioncontext: executionContext.event, - runtab: events + runtab: appEvents.eventManager }, api: appAPI }) @@ -241,8 +242,8 @@ function makeRecorder (events, appAPI, appEvents, opts, self) { var obj = JSON.parse(json) var txArray = obj.transactions || [] var accounts = obj.accounts || [] - var options = obj.options - var abis = obj.abis + var options = obj.options || {} + var abis = obj.abis || {} var linkReferences = obj.linkReferences || {} } catch (e) { return modalDialogCustom.alert('Invalid Scenario File, please try again') @@ -250,7 +251,7 @@ function makeRecorder (events, appAPI, appEvents, opts, self) { if (txArray.length) { var noInstancesText = self._view.noInstancesText if (noInstancesText.parentNode) { noInstancesText.parentNode.removeChild(noInstancesText) } - recorder.run(txArray, accounts, options, abis, linkReferences, (abi, address, contractName) => { + recorder.run(txArray, accounts, options, abis, linkReferences, opts.udapp, (abi, address, contractName) => { self._view.instanceContainer.appendChild(opts.udappUI.renderInstanceFromABI(abi, address, contractName)) }) } diff --git a/src/universal-dapp-styles.js b/src/universal-dapp-styles.js index 8ac6cb18a8..4d15387aa2 100644 --- a/src/universal-dapp-styles.js +++ b/src/universal-dapp-styles.js @@ -22,7 +22,7 @@ var css = csjs` margin-bottom: 10px; } .noInstancesText { - + } .titleLine { display: flex; @@ -84,6 +84,7 @@ var css = csjs` cursor: pointer; margin-left: 5px; } + .udapp {} .udappClose { display: flex; justify-content: flex-end;