Commit c12bf917 authored by Iuri Matias's avatar Iuri Matias

fix linting issues; issue with deploy

parent 8ccc4cdd
...@@ -107,7 +107,7 @@ class ContractDropdownUI { ...@@ -107,7 +107,7 @@ class ContractDropdownUI {
} }
const selectedContract = this.getSelectedContract() const selectedContract = this.getSelectedContract()
const clickCallback = (valArray, inputsValues) => { const clickCallback = async (valArray, inputsValues) => {
var selectedContract = this.getSelectedContract() var selectedContract = this.getSelectedContract()
this.createInstance(selectedContract, inputsValues) this.createInstance(selectedContract, inputsValues)
} }
...@@ -130,7 +130,7 @@ class ContractDropdownUI { ...@@ -130,7 +130,7 @@ class ContractDropdownUI {
return this.dropdownLogic.getSelectedContract(contractName, compilerAtributeName) return this.dropdownLogic.getSelectedContract(contractName, compilerAtributeName)
} }
createInstance (selectedContract, args) { async createInstance (selectedContract, args) {
if (selectedContract.bytecodeObject.length === 0) { if (selectedContract.bytecodeObject.length === 0) {
return modalDialogCustom.alert('This contract may be abstract, not implement an abstract parent\'s methods completely or not invoke an inherited contract\'s constructor correctly.') return modalDialogCustom.alert('This contract may be abstract, not implement an abstract parent\'s methods completely or not invoke an inherited contract\'s constructor correctly.')
} }
......
...@@ -149,22 +149,27 @@ class DropdownLogic { ...@@ -149,22 +149,27 @@ class DropdownLogic {
) )
} }
determineGasFees(gasPrice, cb) { // determineGasFees (gasPrice, cb) {
let txFeeText, priceStatus determineGasFees (tx) {
// TODO: this try catch feels like an anti pattern, can/should be const determineGasFeesCb = (gasPrice, cb) => {
// removed, but for now keeping the original logic let txFeeText, priceStatus
try { // TODO: this try catch feels like an anti pattern, can/should be
var fee = this.calculateFee(tx.gas, gasPrice) // removed, but for now keeping the original logic
txFeeText = ' ' + this.fromWei(fee, false, 'ether') + ' Ether' try {
priceStatus = true var fee = this.calculateFee(tx.gas, gasPrice)
} catch (e) { txFeeText = ' ' + this.fromWei(fee, false, 'ether') + ' Ether'
txFeeText = ' Please fix this issue before sending any transaction. ' + e.message priceStatus = true
priceStatus = false } catch (e) {
txFeeText = ' Please fix this issue before sending any transaction. ' + e.message
priceStatus = false
}
cb(txFeeText, priceStatus)
} }
cb(txFeeText, priceStatus)
return determineGasFeesCb
} }
determineGasPrice(cb) { determineGasPrice (cb) {
this.getGasPrice((error, gasPrice) => { this.getGasPrice((error, gasPrice) => {
var warnMessage = ' Please fix this issue before sending any transaction. ' var warnMessage = ' Please fix this issue before sending any transaction. '
if (error) { if (error) {
...@@ -179,13 +184,13 @@ class DropdownLogic { ...@@ -179,13 +184,13 @@ class DropdownLogic {
}) })
} }
getConfirmationCb(modalDialog, confirmDialog) { getConfirmationCb (modalDialog, confirmDialog) {
const confirmationCb = (network, tx, gasEstimation, continueTxExecution, cancelCb) => { const confirmationCb = (network, tx, gasEstimation, continueTxExecution, cancelCb) => {
if (network.name !== 'Main') { if (network.name !== 'Main') {
return continueTxExecution(null) return continueTxExecution(null)
} }
const amount = this.fromWei(tx.value, true, 'ether') const amount = this.fromWei(tx.value, true, 'ether')
const content = confirmDialog(tx, amount, gasEstimation, null, this.determineGasFees, this.determineGasPrice) const content = confirmDialog(tx, amount, gasEstimation, null, this.determineGasFees(tx), this.determineGasPrice)
modalDialog('Confirm transaction', content, modalDialog('Confirm transaction', content,
{ label: 'Confirm', { label: 'Confirm',
...@@ -215,12 +220,12 @@ class DropdownLogic { ...@@ -215,12 +220,12 @@ class DropdownLogic {
this.udapp.runTx(data, confirmationCb, continueCb, promptCb, finalCb) this.udapp.runTx(data, confirmationCb, continueCb, promptCb, finalCb)
} }
getCompilerContracts() { getCompilerContracts () {
return this.compilersArtefacts['__last'].getData().contracts return this.compilersArtefacts['__last'].getData().contracts
} }
async deploContract (selectedContract, args, contractMetadata, compilerContracts, callbacks, dialogs) { async deployContract (selectedContract, args, contractMetadata, compilerContracts, callbacks, dialogs) {
const {continueCb, promptCb, statusCb, finalCb} = callbacks const {continueCb, promptCb, statusCb, finalCb} = callbacks
const {modalDialog, confirmDialog} = dialogs const {modalDialog, confirmDialog} = dialogs
var constructor = selectedContract.getConstructorInterface() var constructor = selectedContract.getConstructorInterface()
......
...@@ -134,7 +134,7 @@ export class RunTab extends LibraryPlugin { ...@@ -134,7 +134,7 @@ export class RunTab extends LibraryPlugin {
const dropdownLogic = new DropdownLogic(this.executionContext, compilersArtefacts, config, editor, udapp, this) const dropdownLogic = new DropdownLogic(this.executionContext, compilersArtefacts, config, editor, udapp, this)
this.contractDropdownUI = new ContractDropdownUI(dropdownLogic, logCallback, this) this.contractDropdownUI = new ContractDropdownUI(dropdownLogic, logCallback, this)
fileManager.events.on('currentFileChanged', contractDropdownUI.changeCurrentFile.bind(contractDropdownUI)) fileManager.events.on('currentFileChanged', this.contractDropdownUI.changeCurrentFile.bind(this.contractDropdownUI))
this.contractDropdownUI.event.register('clearInstance', () => { this.contractDropdownUI.event.register('clearInstance', () => {
const noInstancesText = this.noInstancesText const noInstancesText = this.noInstancesText
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment