From 03f55cc5649cdfc1a3c206dc026ebfcaa12ce32d Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 4 Jan 2018 19:07:56 +0100 Subject: [PATCH 1/2] fix run scenario from remixd --- src/app/tabs/run-tab.js | 45 +++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index 707720f3e0..52b9f949c4 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -327,27 +327,32 @@ function makeRecorder (events, appAPI, appEvents) { } runButton.onclick = () => { var currentFile = appAPI.config.get('currentFile') - var json = appAPI.filesProviders['browser'].get(currentFile) - if (currentFile.match('.json$')) { - try { - var obj = JSON.parse(json) - var txArray = obj.transactions || [] - var accounts = obj.accounts || [] - var options = obj.options - var abis = obj.abis - var linkReferences = obj.linkReferences || {} - } catch (e) { - return modalDialogCustom.alert('Invalid Scenario File, please try again') - } - if (txArray.length) { - noInstancesText.style.display = 'none' - recorder.run(txArray, accounts, options, abis, linkReferences, (abi, address, contractName) => { - instanceContainer.appendChild(appAPI.udapp().renderInstanceFromABI(abi, address, contractName)) - }) + appAPI.fileProviderOf(currentFile).get(currentFile, (error, json) => { + if (error) { + modalDialogCustom.alert('Invalid Scenario File ' + error) + } else { + if (currentFile.match('.json$')) { + try { + var obj = JSON.parse(json) + var txArray = obj.transactions || [] + var accounts = obj.accounts || [] + var options = obj.options + var abis = obj.abis + var linkReferences = obj.linkReferences || {} + } catch (e) { + return modalDialogCustom.alert('Invalid Scenario File, please try again') + } + if (txArray.length) { + noInstancesText.style.display = 'none' + recorder.run(txArray, accounts, options, abis, linkReferences, (abi, address, contractName) => { + instanceContainer.appendChild(appAPI.udapp().renderInstanceFromABI(abi, address, contractName)) + }) + } + } else { + modalDialogCustom.alert('A Scenario File is required. The file must be of type JSON. Use the "Save Transactions" Button to generate a new Scenario File.') + } } - } else { - modalDialogCustom.alert('A Scenario File is required. The file must be of type JSON. Use the "Save Transactions" Button to generate a new Scenario File.') - } + }) } return { recordButton, runButton } } From 1bd694b6cb8586087328bc25b6bf16af11dd04a7 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 4 Jan 2018 19:10:35 +0100 Subject: [PATCH 2/2] add alert if publish to gist fails --- src/app/panels/file-panel.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/panels/file-panel.js b/src/app/panels/file-panel.js index 881fff2cad..b3c70dc2af 100644 --- a/src/app/panels/file-panel.js +++ b/src/app/panels/file-panel.js @@ -348,6 +348,7 @@ function filepanel (appAPI, filesProvider) { packageFiles(filesProvider['browser'], (error, packaged) => { if (error) { console.log(error) + modalDialogCustom.alert('Failed to create gist: ' + error) } else { var description = 'Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. \n Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=' + queryParams.get().version + '&optimize=' + queryParams.get().optimize + '&gist=' console.log(packaged)