From b07046e3f062aecfe212ea4836c3159505642b7b Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 26 Feb 2015 19:02:26 +0100 Subject: [PATCH] small changes --- mix/qml/DeploymentDialog.qml | 156 ----------------------------------- mix/qml/ProjectModel.qml | 2 +- mix/qml/js/ProjectModel.js | 13 +-- 3 files changed, 5 insertions(+), 166 deletions(-) diff --git a/mix/qml/DeploymentDialog.qml b/mix/qml/DeploymentDialog.qml index 65c63be8d..b9a194220 100644 --- a/mix/qml/DeploymentDialog.qml +++ b/mix/qml/DeploymentDialog.qml @@ -24,7 +24,6 @@ Window { property string packageHash property alias packageBase64: base64Value.text property string eth: "4c3f7330690ed3657d3fa20fe5717b84010528ae"; /* TODO: replace with the good address */ - property string yanndappRegistrar: "29a2e6d3c56ef7713a4e7229c3d1a23406f0161a"; /* TODO: Only fur testing purpose. To remove when registrar contract will be deployed in genesis block */ property string currentAccount property alias gasToUse: gasToUseInput.text @@ -287,161 +286,6 @@ Window { text: qsTr("Close"); onClicked: close(); } - - /* TODO: Only fur testing purpose. To remove when registrar contract will be deployed in genesis block */ - Button { - text: qsTr("Checking eth/yanndapp"); - visible : false - onClicked: { - var requests = []; - var ethStr = QEtherHelper.createString("yanndapp"); - - requests.push({ //owner - jsonrpc: "2.0", - method: "eth_call", - params: [ { "to": '0x' + modalDeploymentDialog.eth, "data": "0xec7b9200" + ethStr.encodeValueAsString() } ], //check for yanndappRegistrar in eth - id: 1 - }); - - requests.push({ //register - jsonrpc: "2.0", - method: "eth_call", - params: [ { "to": '0x' + modalDeploymentDialog.eth, "data": "0x6be16bed" + ethStr.encodeValueAsString() } ], //getregister yanndappRegistrar in eth - id: 2 - }); - - - requests.push({ //getOwner - jsonrpc: "2.0", - method: "eth_call", - params: [ { "to": '0x' + modalDeploymentDialog.yanndappRegistrar, "data": "0x893d20e8" } ], //check owner of this registrar - id: 3 - }); - - /*requests.push({ //register - jsonrpc: "2.0", - method: "eth_call", - params: [ { "to": '0x' + modalDeploymentDialog.yanndappRegistrar, "data": "0x6be16bed" + ethStr.encodeValueAsString() } ], - id: 2 - });*/ - - - - var jsonRpcUrl = "http://localhost:8080"; - var rpcRequest = JSON.stringify(requests); - var httpRequest = new XMLHttpRequest(); - httpRequest.open("POST", jsonRpcUrl, true); - httpRequest.setRequestHeader("Content-type", "application/json"); - httpRequest.setRequestHeader("Content-length", rpcRequest.length); - httpRequest.setRequestHeader("Connection", "close"); - httpRequest.onreadystatechange = function() { - if (httpRequest.readyState === XMLHttpRequest.DONE) { - if (httpRequest.status === 200) { - console.log(httpRequest.responseText); - } else { - var errorText = qsTr("path registration failed ") + httpRequest.status; - console.log(errorText); - } - } - } - httpRequest.send(rpcRequest); - } - } - - /* TODO: Only fur testing purpose. To remove when registrar contract will be deployed in genesis block */ - Button { - text: qsTr("add contracts"); - visible : false - onClicked: { - var jsonRpcRequestId = 0; - var requests = []; - requests.push({ - jsonrpc: "2.0", - method: "eth_transact", - params: [ { "gas": 20000, "code": "0x60056011565b600180601c6000396000f35b6008600081905550560000" } ], - id: jsonRpcRequestId++ - }); - - var jsonRpcUrl = "http://localhost:8080"; - var rpcRequest = JSON.stringify(requests); - var httpRequest = new XMLHttpRequest(); - httpRequest.open("POST", jsonRpcUrl, true); - httpRequest.setRequestHeader("Content-type", "application/json"); - httpRequest.setRequestHeader("Content-length", rpcRequest.length); - httpRequest.setRequestHeader("Connection", "close"); - httpRequest.onreadystatechange = function() { - if (httpRequest.readyState === XMLHttpRequest.DONE) { - console.log(httpRequest.responseText); - var requests = []; - - requests.push({ - jsonrpc: "2.0", - method: "eth_transact", - params: [ { "gas": 20000, "code": "0x60056011565b600180601c6000396000f35b6009600081905550560000" } ], - id: jsonRpcRequestId++ - }); - rpcRequest = JSON.stringify(requests); - httpRequest = new XMLHttpRequest(); - httpRequest.open("POST", jsonRpcUrl, true); - httpRequest.setRequestHeader("Content-type", "application/json"); - httpRequest.setRequestHeader("Content-length", rpcRequest.length); - httpRequest.setRequestHeader("Connection", "close"); - httpRequest.onreadystatechange = function() { - if (httpRequest.readyState === XMLHttpRequest.DONE) { - console.log(httpRequest.responseText); - } - } - httpRequest.send(rpcRequest); - } - } - httpRequest.send(rpcRequest); - } - } - - /* TODO: Only fur testing purpose. To remove when registrar contract will be deployed in genesis block */ - Button { - text: qsTr("Registering eth/yanndapp"); - visible: false - onClicked: { - console.log("registering eth/yanndapp") - var jsonRpcRequestId = 0; - var requests = []; - var ydapp = QEtherHelper.createString("yanndapp"); - - requests.push({ //reserve - jsonrpc: "2.0", - method: "eth_transact", - params: [ { "gas": 2000, "to": '0x' + modalDeploymentDialog.eth, "data": "0x1c83171b" + ydapp.encodeValueAsString() } ], - id: jsonRpcRequestId++ - }); - - requests.push({ //setRegister - jsonrpc: "2.0", - method: "eth_transact", - params: [ { "gas": 2000, "to": '0x' + modalDeploymentDialog.eth, "data": "0x96077307" + ydapp.encodeValueAsString() + modalDeploymentDialog.pad(modalDeploymentDialog.yanndappRegistrar) } ], - id: jsonRpcRequestId++ - }); - - var jsonRpcUrl = "http://localhost:8080"; - var rpcRequest = JSON.stringify(requests); - var httpRequest = new XMLHttpRequest(); - httpRequest.open("POST", jsonRpcUrl, true); - httpRequest.setRequestHeader("Content-type", "application/json"); - httpRequest.setRequestHeader("Content-length", rpcRequest.length); - httpRequest.setRequestHeader("Connection", "close"); - httpRequest.onreadystatechange = function() { - if (httpRequest.readyState === XMLHttpRequest.DONE) { - if (httpRequest.status === 200) { - console.log(httpRequest.responseText); - } else { - var errorText = qsTr("path registration failed ") + httpRequest.status; - console.log(errorText); - } - } - } - httpRequest.send(rpcRequest); - } - } } } } diff --git a/mix/qml/ProjectModel.qml b/mix/qml/ProjectModel.qml index 86eab956a..7e4e8cb49 100644 --- a/mix/qml/ProjectModel.qml +++ b/mix/qml/ProjectModel.qml @@ -99,7 +99,7 @@ Item { text: { if (Object.keys(projectModel.deploymentAddresses).length > 0) - return qsTr("This project has been already deployed to the network. Do you want to redeploy it? (Contract state will be reseted)") + return qsTr("This project has been already deployed to the network. Do you want to redeploy it? (Contract state will be reset)") else return qsTr("This action will deploy to the network. Do you want to deploy it?") } diff --git a/mix/qml/js/ProjectModel.js b/mix/qml/js/ProjectModel.js index 16670242c..55408c6d8 100644 --- a/mix/qml/js/ProjectModel.js +++ b/mix/qml/js/ProjectModel.js @@ -585,15 +585,10 @@ function registerToUrlHint() function normalizeAddress(addr) { addr = addr.replace('0x', ''); - var i = 0; - for (var k in addr) - { - if (addr[k] !== "0" || addr.length === 40) - break; - else - i++; - } - return addr.substring(i); + if (addr.length <= 40) + return addr; + var left = addr.length - 40; + return addr.substring(left); } function formatAppUrl(url)