|
|
@ -367,23 +367,8 @@ function startDeployProject(erasePrevious) |
|
|
|
|
|
|
|
var ctrNames = Object.keys(codeModel.contracts); |
|
|
|
var ctrAddresses = {}; |
|
|
|
setDefaultBlock(0, function() { |
|
|
|
deployContracts(0, ctrAddresses, ctrNames, function (){ |
|
|
|
finalizeDeployment(deploymentId, ctrAddresses); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function setDefaultBlock(val, callBack) |
|
|
|
{ |
|
|
|
var requests = [{ |
|
|
|
jsonrpc: "2.0", |
|
|
|
method: "eth_setDefaultBlock", |
|
|
|
params: [val], |
|
|
|
id: 0 |
|
|
|
}]; |
|
|
|
rpcCall(requests, function (httpCall, response){ |
|
|
|
callBack(); |
|
|
|
deployContracts(0, ctrAddresses, ctrNames, function (){ |
|
|
|
finalizeDeployment(deploymentId, ctrAddresses); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -392,7 +377,7 @@ function deployContracts(ctrIndex, ctrAddresses, ctrNames, callBack) |
|
|
|
var code = codeModel.contracts[ctrNames[ctrIndex]].codeHex; |
|
|
|
var requests = [{ |
|
|
|
jsonrpc: "2.0", |
|
|
|
method: "eth_transact", |
|
|
|
method: "eth_sendTransaction", |
|
|
|
params: [ { "from": deploymentDialog.currentAccount, "gas": deploymentDialog.gasToUse, "code": code } ], |
|
|
|
id: 0 |
|
|
|
}]; |
|
|
@ -452,7 +437,8 @@ function finalizeDeployment(deploymentId, addresses) { |
|
|
|
"\tinterface: " + codeModel.contracts[c].contractInterface + ",\n" + |
|
|
|
"\taddress: \"" + addresses[c] + "\"\n" + |
|
|
|
"};\n" + |
|
|
|
contractAccessor + ".contract = web3.eth.contract(" + contractAccessor + ".address, " + contractAccessor + ".interface);\n"; |
|
|
|
contractAccessor + ".contractClass = web3.eth.contract(" + contractAccessor + ".interface);\n" + |
|
|
|
contractAccessor + ".contract = new " + contractAccessor + ".contractClass(" + contractAccessor + ".address);\n"; |
|
|
|
} |
|
|
|
fileIo.writeFile(deploymentDir + "deployment.js", deploymentJs); |
|
|
|
deploymentAddresses = addresses; |
|
|
@ -461,6 +447,7 @@ function finalizeDeployment(deploymentId, addresses) { |
|
|
|
var packageRet = fileIo.makePackage(deploymentDir); |
|
|
|
deploymentDialog.packageHash = packageRet[0]; |
|
|
|
deploymentDialog.packageBase64 = packageRet[1]; |
|
|
|
deploymentDialog.localPackageUrl = packageRet[2] + "?hash=" + packageRet[0]; |
|
|
|
|
|
|
|
var applicationUrlEth = deploymentDialog.applicationUrlEth; |
|
|
|
|
|
|
@ -468,9 +455,8 @@ function finalizeDeployment(deploymentId, addresses) { |
|
|
|
deploymentStepChanged(qsTr("Registering application on the Ethereum network ...")); |
|
|
|
checkEthPath(applicationUrlEth, function () { |
|
|
|
deploymentComplete(); |
|
|
|
deployRessourcesDialog.text = qsTr("Register Web Application to finalize deployment."); |
|
|
|
deployRessourcesDialog.open(); |
|
|
|
setDefaultBlock(-1, function() {}); |
|
|
|
deployResourcesDialog.text = qsTr("Register Web Application to finalize deployment."); |
|
|
|
deployResourcesDialog.open(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -567,7 +553,7 @@ function checkRegistration(dappUrl, addr, callBack) |
|
|
|
|
|
|
|
requests.push({ |
|
|
|
jsonrpc: "2.0", |
|
|
|
method: "eth_transact", |
|
|
|
method: "eth_sendTransaction", |
|
|
|
params: [ { "from": deploymentDialog.currentAccount, "gas": 20000, "code": "0x60056013565b61059e8061001d6000396000f35b33600081905550560060003560e060020a90048063019848921461009a578063449c2090146100af5780635d574e32146100cd5780635fd4b08a146100e1578063618242da146100f65780636be16bed1461010b5780636c4489b414610129578063893d20e8146101585780639607730714610173578063c284bc2a14610187578063e50f599a14610198578063e5811b35146101af578063ec7b9200146101cd57005b6100a560043561031b565b8060005260206000f35b6100ba6004356103a0565b80600160a060020a031660005260206000f35b6100db600435602435610537565b60006000f35b6100ec600435610529565b8060005260206000f35b6101016004356103dd565b8060005260206000f35b6101166004356103bd565b80600160a060020a031660005260206000f35b61013460043561034b565b82600160a060020a031660005281600160a060020a03166020528060405260606000f35b610160610341565b80600160a060020a031660005260206000f35b6101816004356024356102b4565b60006000f35b6101926004356103fd565b60006000f35b6101a96004356024356044356101f2565b60006000f35b6101ba6004356101eb565b80600160a060020a031660005260206000f35b6101d8600435610530565b80600160a060020a031660005260206000f35b6000919050565b600054600160a060020a031633600160a060020a031614610212576102af565b8160026000858152602001908152602001600020819055508061023457610287565b81600160a060020a0316837f680ad70765443c2967675ab0fb91a46350c01c6df59bf9a41ff8a8dd097464ec60006000a3826001600084600160a060020a03168152602001908152602001600020819055505b827f18d67da0cd86808336a3aa8912f6ea70c5250f1a98b586d1017ef56fe199d4fc60006000a25b505050565b600054600160a060020a031633600160a060020a0316146102d457610317565b806002600084815260200190815260200160002060010181905550817f18d67da0cd86808336a3aa8912f6ea70c5250f1a98b586d1017ef56fe199d4fc60006000a25b5050565b60006001600083600160a060020a03168152602001908152602001600020549050919050565b6000600054905090565b6000600060006002600085815260200190815260200160002054925060026000858152602001908152602001600020600101549150600260008581526020019081526020016000206002015490509193909250565b600060026000838152602001908152602001600020549050919050565b600060026000838152602001908152602001600020600101549050919050565b600060026000838152602001908152602001600020600201549050919050565b600054600160a060020a031633600160a060020a03161461041d57610526565b80600160006002600085815260200190815260200160002054600160a060020a031681526020019081526020016000205414610458576104d2565b6002600082815260200190815260200160002054600160a060020a0316817f680ad70765443c2967675ab0fb91a46350c01c6df59bf9a41ff8a8dd097464ec60006000a36000600160006002600085815260200190815260200160002054600160a060020a03168152602001908152602001600020819055505b6002600082815260200190815260200160002060008101600090556001810160009055600281016000905550807f18d67da0cd86808336a3aa8912f6ea70c5250f1a98b586d1017ef56fe199d4fc60006000a25b50565b6000919050565b6000919050565b600054600160a060020a031633600160a060020a0316146105575761059a565b806002600084815260200190815260200160002060020181905550817f18d67da0cd86808336a3aa8912f6ea70c5250f1a98b586d1017ef56fe199d4fc60006000a25b505056" } ], |
|
|
|
id: jsonRpcRequestId++ |
|
|
|
}); |
|
|
@ -588,7 +574,7 @@ function checkRegistration(dappUrl, addr, callBack) |
|
|
|
requests.push({ |
|
|
|
//setRegister()
|
|
|
|
jsonrpc: "2.0", |
|
|
|
method: "eth_transact", |
|
|
|
method: "eth_sendTransaction", |
|
|
|
params: [ { "from": deploymentDialog.currentAccount, "gas": 30000, "to": '0x' + addr, "data": "0x96077307" + crLevel + deploymentDialog.pad(newCtrAddress) } ], |
|
|
|
id: jsonRpcRequestId++ |
|
|
|
}); |
|
|
@ -617,12 +603,12 @@ function registerContentHash(registrar, callBack) |
|
|
|
deploymentStepChanged(txt); |
|
|
|
console.log(txt); |
|
|
|
var requests = []; |
|
|
|
var paramTitle = createString(projectModel.projectTitle); |
|
|
|
var paramTitle = clientModel.encodeAbiString(projectModel.projectTitle); |
|
|
|
requests.push({ |
|
|
|
//setContent()
|
|
|
|
jsonrpc: "2.0", |
|
|
|
method: "eth_transact", |
|
|
|
params: [ { "from": deploymentDialog.currentAccount, "gas": 30000, "gasPrice": "10", "to": '0x' + registrar, "data": "0x5d574e32" + paramTitle.encodeValueAsString() + deploymentDialog.packageHash } ], |
|
|
|
method: "eth_sendTransaction", |
|
|
|
params: [ { "from": deploymentDialog.currentAccount, "gas": 30000, "gasPrice": "10", "to": '0x' + registrar, "data": "0x5d574e32" + paramTitle + deploymentDialog.packageHash } ], |
|
|
|
id: jsonRpcRequestId++ |
|
|
|
}); |
|
|
|
rpcCall(requests, function (httpRequest, response) { |
|
|
@ -638,7 +624,7 @@ function registerToUrlHint() |
|
|
|
requests.push({ |
|
|
|
//urlHint => suggestUrl
|
|
|
|
jsonrpc: "2.0", |
|
|
|
method: "eth_transact", |
|
|
|
method: "eth_sendTransaction", |
|
|
|
params: [ { "to": '0x' + deploymentDialog.urlHintContract, "gas": 30000, "data": "0x4983e19c" + deploymentDialog.packageHash + paramUrlHttp.encodeValueAsString() } ], |
|
|
|
id: jsonRpcRequestId++ |
|
|
|
}); |
|
|
|