diff --git a/mix/qml/Application.qml b/mix/qml/Application.qml index 8ee70942d..5ae12b816 100644 --- a/mix/qml/Application.qml +++ b/mix/qml/Application.qml @@ -44,7 +44,6 @@ ApplicationWindow { codeModel: codeModel Component.onCompleted: { - console.log("tmp") init("/tmp") } } diff --git a/mix/qml/DeployContractStep.qml b/mix/qml/DeployContractStep.qml index 0d93630bf..ddb8529a4 100644 --- a/mix/qml/DeployContractStep.qml +++ b/mix/qml/DeployContractStep.qml @@ -30,6 +30,15 @@ Rectangle { } if (worker.accounts.length > 0) worker.currentAccount = worker.accounts[0].id + + if (projectModel.deployBlockNumber) + { + worker.blockNumber(function (bn) + { + verificationLabel.text = bn - projectModel.deployBlockNumber + }); + } + deployedAddresses.refresh() } @@ -58,7 +67,8 @@ Rectangle { textRole: "title" onCurrentIndexChanged: { - change() + if (root.visible) + change() } function change() @@ -188,6 +198,7 @@ Rectangle { Layout.preferredWidth: parent.width * 0.60 Layout.fillHeight: true id: deploymentOption + spacing: 8 Label { @@ -343,7 +354,7 @@ Rectangle { Label { id: labelAddresses - text: qsTr("Deployed Addresses") + text: qsTr("Deployed Contracts") anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter } @@ -351,7 +362,8 @@ Rectangle { ColumnLayout { - + anchors.top: parent.top + anchors.topMargin: 1 ListModel { id: deployedAddrModel @@ -380,13 +392,15 @@ Rectangle { Label { id: labelContract - width: 110 + width: 112 elide: Text.ElideRight text: index > -1 ? deployedAddrModel.get(index).id : "" } TextField { + width: 123 + anchors.verticalCenter: parent.verticalCenter anchors.left: labelContract.right text: index > - 1 ? deployedAddrModel.get(index).value : "" } @@ -394,6 +408,28 @@ Rectangle { } } } + + RowLayout + { + id: verificationRow + Layout.fillWidth: true + visible: Object.keys(projectModel.deploymentAddresses).length > 0 + Rectangle + { + width: labelWidth + Label + { + text: qsTr("Verifications") + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + } + } + + Label + { + id: verificationLabel + } + } } Rectangle @@ -409,6 +445,12 @@ Rectangle { projectModel.deployedScenarioIndex = contractList.currentIndex NetworkDeploymentCode.deployContracts(root.gas, function(addresses) { + worker.blockNumber(function (nb) + { + projectModel.deployBlockNumber = nb + verificationLabel.text = "0" + projectModel.saveProject() + }) projectModel.deploymentAddresses = addresses projectModel.saveProject() deployedAddresses.refresh() diff --git a/mix/qml/DeploymentWorker.qml b/mix/qml/DeploymentWorker.qml index 06c0e6f2e..7493e4b23 100644 --- a/mix/qml/DeploymentWorker.qml +++ b/mix/qml/DeploymentWorker.qml @@ -87,6 +87,21 @@ Item poolLog.start(); } + function blockNumber(callback) + { + var requests = []; + requests.push({ + jsonrpc: "2.0", + method: "eth_blockNumber", + params: [], + id: 0 + }); + TransactionHelper.rpcCall(requests, function (httpRequest, response){ + var b = JSON.parse(response)[0].result; + callback(parseInt(b, 16)) + }); + } + Component.onCompleted: { renewCtx() @@ -168,6 +183,6 @@ Item } }) } - } + } } diff --git a/mix/qml/PackagingStep.qml b/mix/qml/PackagingStep.qml index ba3b16773..424732869 100644 --- a/mix/qml/PackagingStep.qml +++ b/mix/qml/PackagingStep.qml @@ -106,6 +106,7 @@ Rectangle { onClicked: { NetworkDeploymentCode.packageDapp(projectModel.deploymentAddresses); + projectModel.saveProject() } } diff --git a/mix/qml/ProjectModel.qml b/mix/qml/ProjectModel.qml index 62173418e..96cf2f72a 100644 --- a/mix/qml/ProjectModel.qml +++ b/mix/qml/ProjectModel.qml @@ -51,6 +51,7 @@ Item { property int deployedScenarioIndex property string applicationUrlEth property string applicationUrlHttp + property string deployBlockNumber //interface function saveAll() { ProjectModelCode.saveAll(); } diff --git a/mix/qml/RegisteringStep.qml b/mix/qml/RegisteringStep.qml index e6399421e..d8ebf3b34 100644 --- a/mix/qml/RegisteringStep.qml +++ b/mix/qml/RegisteringStep.qml @@ -179,7 +179,6 @@ Rectangle { { id: appUrlFormatted anchors.verticalCenter: parent.verticalCenter; - anchors.top: applicationUrlEthCtrl.bottom anchors.topMargin: 10 font.italic: true font.pointSize: appStyle.absoluteSize(-1) diff --git a/mix/qml/ScenarioExecution.qml b/mix/qml/ScenarioExecution.qml index 687c8e99f..00c09f4cf 100644 --- a/mix/qml/ScenarioExecution.qml +++ b/mix/qml/ScenarioExecution.qml @@ -32,7 +32,6 @@ Rectangle { { id: columnExe Layout.preferredWidth: parent.width - width: parent.width - 40 anchors.left: parent.left anchors.leftMargin: 15 ColumnLayout diff --git a/mix/qml/ScenarioLoader.qml b/mix/qml/ScenarioLoader.qml index a54eb48bf..0de779135 100644 --- a/mix/qml/ScenarioLoader.qml +++ b/mix/qml/ScenarioLoader.qml @@ -154,7 +154,7 @@ ColumnLayout function updateLabel() { comboLabel.text = "" - if (scenarioList.currentIndex < projectModel.stateListModel.count) + if (scenarioList.currentIndex > - 1 && scenarioList.currentIndex < projectModel.stateListModel.count) comboLabel.text = projectModel.stateListModel.getState(scenarioList.currentIndex).title } diff --git a/mix/qml/js/ProjectModel.js b/mix/qml/js/ProjectModel.js index f4959191e..2230fa290 100644 --- a/mix/qml/js/ProjectModel.js +++ b/mix/qml/js/ProjectModel.js @@ -79,7 +79,9 @@ function saveProjectFile() packageHash: deploymentDialog.packageStep.packageHash, packageBase64: deploymentDialog.packageStep.packageBase64, deploymentDir: deploymentDialog.packageStep.packageDir, - lastPackageDate: deploymentDialog.packageStep.lastDeployDate + lastPackageDate: deploymentDialog.packageStep.lastDeployDate, + deployBlockNumber: projectModel.deployBlockNumber, + localPackageUrl: deploymentDialog.packageStep.localPackageUrl }; for (var i = 0; i < projectListModel.count; i++) projectData.files.push({ @@ -117,6 +119,10 @@ function loadProject(path) { projectModel.applicationUrlHttp = projectData.applicationUrlHttp if (projectData.lastPackageDate) deploymentDialog.packageStep.lastDeployDate = projectData.lastPackageDate + if (projectData.deployBlockNumber) + projectModel.deployBlockNumber = projectData.deployBlockNumber + if (projectData.localPackageUrl) + deploymentDialog.packageStep.localPackageUrl = projectData.localPackageUrl if (!projectData.title) { var parts = path.split("/"); projectData.title = parts[parts.length - 2];