|
|
@ -253,11 +253,17 @@ function generateFileName(name, extension) { |
|
|
|
|
|
|
|
|
|
|
|
var jsonRpcRequestId = 1; |
|
|
|
function deployProject() { |
|
|
|
function deployProject(force) { |
|
|
|
|
|
|
|
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"; |
|
|
|
console.log("Deploying " + deploymentId + " to " + jsonRpcUrl); |
|
|
|
deploymentStarted(); |
|
|
@ -283,7 +289,7 @@ function deployProject() { |
|
|
|
console.log("Created contract, address: " + address); |
|
|
|
finalizeDeployment(deploymentId, address); |
|
|
|
} 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); |
|
|
|
deploymentError(errorText); |
|
|
|
} |
|
|
@ -324,16 +330,17 @@ function finalizeDeployment(deploymentId, address) { |
|
|
|
"// Autogenerated by Mix\n" + |
|
|
|
"var web3 = require(\"web3\");\n" + |
|
|
|
"var contractInterface = " + codeModel.code.contractInterface + ";\n" + |
|
|
|
"deployment = {\n" + |
|
|
|
"deploy = {\n" + |
|
|
|
"\tweb3: web3,\n" + |
|
|
|
"\tcontractAddress: \"" + address + "\",\n" + |
|
|
|
"\tcontractInterface: contractInterface,\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); |
|
|
|
//copy scripts
|
|
|
|
fileIo.copyFile("qrc:///js/bignumber.min.js", deploymentDir + "bignumber.min.js"); |
|
|
|
fileIo.copyFile("qrc:///js/webthree.js", deploymentDir + "ethereum.js"); |
|
|
|
deploymentAddress = address; |
|
|
|
saveProject(); |
|
|
|
deploymentComplete(); |
|
|
|
} |
|
|
|