|
@ -253,11 +253,17 @@ function generateFileName(name, extension) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var jsonRpcRequestId = 1; |
|
|
var jsonRpcRequestId = 1; |
|
|
function deployProject() { |
|
|
function deployProject(force) { |
|
|
|
|
|
|
|
|
saveAll(); //TODO: ask user
|
|
|
saveAll(); //TODO: ask user
|
|
|
|
|
|
|
|
|
var deploymentId = Date.now().toLocaleString("ddMMyyyHHmmsszzz"); |
|
|
if (!force && deploymentAddress !== "") { |
|
|
|
|
|
deployWarningDialog.visible = true; |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var date = new Date(); |
|
|
|
|
|
var deploymentId = date.toLocaleString(Qt.locale(), "ddMMyyHHmmsszzz"); |
|
|
var jsonRpcUrl = "http://localhost:8080"; |
|
|
var jsonRpcUrl = "http://localhost:8080"; |
|
|
console.log("Deploying " + deploymentId + " to " + jsonRpcUrl); |
|
|
console.log("Deploying " + deploymentId + " to " + jsonRpcUrl); |
|
|
deploymentStarted(); |
|
|
deploymentStarted(); |
|
@ -283,7 +289,7 @@ function deployProject() { |
|
|
console.log("Created contract, address: " + address); |
|
|
console.log("Created contract, address: " + address); |
|
|
finalizeDeployment(deploymentId, address); |
|
|
finalizeDeployment(deploymentId, address); |
|
|
} else { |
|
|
} else { |
|
|
var errorText = qsTr("Deployment error: RPC server HTTP status ") + http.status; |
|
|
var errorText = qsTr("Deployment error: RPC server HTTP status ") + httpRequest.status; |
|
|
console.log(errorText); |
|
|
console.log(errorText); |
|
|
deploymentError(errorText); |
|
|
deploymentError(errorText); |
|
|
} |
|
|
} |
|
@ -324,16 +330,17 @@ function finalizeDeployment(deploymentId, address) { |
|
|
"// Autogenerated by Mix\n" + |
|
|
"// Autogenerated by Mix\n" + |
|
|
"var web3 = require(\"web3\");\n" + |
|
|
"var web3 = require(\"web3\");\n" + |
|
|
"var contractInterface = " + codeModel.code.contractInterface + ";\n" + |
|
|
"var contractInterface = " + codeModel.code.contractInterface + ";\n" + |
|
|
"deployment = {\n" + |
|
|
"deploy = {\n" + |
|
|
"\tweb3: web3,\n" + |
|
|
"\tweb3: web3,\n" + |
|
|
"\tcontractAddress: \"" + address + "\",\n" + |
|
|
"\tcontractAddress: \"" + address + "\",\n" + |
|
|
"\tcontractInterface: contractInterface,\n" + |
|
|
"\tcontractInterface: contractInterface,\n" + |
|
|
"};\n" + |
|
|
"};\n" + |
|
|
"deplyment.contract = web3.eth.contract(deplyment.contractAddress, deployment.contractInterface);\n"; |
|
|
"deploy.contract = web3.eth.contract(deploy.contractAddress, deploy.contractInterface);\n"; |
|
|
fileIo.writeFile(deploymentDir + "deployment.js", deploymentJs); |
|
|
fileIo.writeFile(deploymentDir + "deployment.js", deploymentJs); |
|
|
//copy scripts
|
|
|
//copy scripts
|
|
|
fileIo.copyFile("qrc:///js/bignumber.min.js", deploymentDir + "bignumber.min.js"); |
|
|
fileIo.copyFile("qrc:///js/bignumber.min.js", deploymentDir + "bignumber.min.js"); |
|
|
fileIo.copyFile("qrc:///js/webthree.js", deploymentDir + "ethereum.js"); |
|
|
fileIo.copyFile("qrc:///js/webthree.js", deploymentDir + "ethereum.js"); |
|
|
|
|
|
deploymentAddress = address; |
|
|
saveProject(); |
|
|
saveProject(); |
|
|
deploymentComplete(); |
|
|
deploymentComplete(); |
|
|
} |
|
|
} |
|
|