From f8ece5a16ece80f805019d28b649664c1e483a7c Mon Sep 17 00:00:00 2001 From: arkpar Date: Sun, 5 Apr 2015 13:18:04 +0200 Subject: [PATCH 1/4] reflect ethereum.js api changes --- alethzero/DappLoader.cpp | 1 + alethzero/DappLoader.h | 1 + mix/qml/DeploymentDialog.qml | 4 ++-- mix/qml/js/ProjectModel.js | 10 +++++----- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/alethzero/DappLoader.cpp b/alethzero/DappLoader.cpp index 821629906..69286c5a3 100644 --- a/alethzero/DappLoader.cpp +++ b/alethzero/DappLoader.cpp @@ -193,6 +193,7 @@ Manifest DappLoader::loadManifest(std::string const& _manifest) void DappLoader::loadDapp(QString const& _uri) { + QUrl contentUri; DappLocation location = resolveAppUri(_uri); QUrl uri(location.contentUri); QNetworkRequest request(uri); diff --git a/alethzero/DappLoader.h b/alethzero/DappLoader.h index 463b65d0a..3e0b30714 100644 --- a/alethzero/DappLoader.h +++ b/alethzero/DappLoader.h @@ -90,5 +90,6 @@ private: dev::WebThreeDirect* m_web3; QNetworkAccessManager m_net; std::map m_uriHashes; + bool m_skipHashVerification = false; }; diff --git a/mix/qml/DeploymentDialog.qml b/mix/qml/DeploymentDialog.qml index c194977cf..f5c10bd40 100644 --- a/mix/qml/DeploymentDialog.qml +++ b/mix/qml/DeploymentDialog.qml @@ -131,8 +131,8 @@ Window { var jsonRpcRequestId = 0; requests.push({ jsonrpc: "2.0", - method: "eth_countAt", - params: [ currentAccount ], + method: "eth_getTransactionCount", + params: [ currentAccount, "pending" ], id: jsonRpcRequestId++ }); TransactionHelper.rpcCall(requests, function (httpRequest, response){ diff --git a/mix/qml/js/ProjectModel.js b/mix/qml/js/ProjectModel.js index 25e8dcb77..1ad90c82b 100644 --- a/mix/qml/js/ProjectModel.js +++ b/mix/qml/js/ProjectModel.js @@ -392,7 +392,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 }]; @@ -567,7 +567,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 +588,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++ }); @@ -621,7 +621,7 @@ function registerContentHash(registrar, callBack) requests.push({ //setContent() jsonrpc: "2.0", - method: "eth_transact", + method: "eth_sendTransaction", params: [ { "from": deploymentDialog.currentAccount, "gas": 30000, "gasPrice": "10", "to": '0x' + registrar, "data": "0x5d574e32" + paramTitle.encodeValueAsString() + deploymentDialog.packageHash } ], id: jsonRpcRequestId++ }); @@ -638,7 +638,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++ }); From fd75bbe852f66aa0f4ec20e81e662b2c77f312c0 Mon Sep 17 00:00:00 2001 From: arkpar Date: Sun, 5 Apr 2015 16:48:29 +0200 Subject: [PATCH 2/4] loading DApps by package url --- alethzero/DappLoader.cpp | 23 +++++++++++++++++++---- alethzero/MainWin.cpp | 2 +- mix/ClientModel.cpp | 6 ++++++ mix/ClientModel.h | 3 +++ mix/ContractCallDataEncoder.cpp | 5 ----- mix/ContractCallDataEncoder.h | 8 ++++---- mix/FileIo.cpp | 1 + mix/qml/DeploymentDialog.qml | 19 +++++++++++++++++-- mix/qml/ProjectModel.qml | 2 +- mix/qml/js/ProjectModel.js | 29 +++++++---------------------- mix/qml/js/QEtherHelper.js | 16 ---------------- 11 files changed, 59 insertions(+), 55 deletions(-) diff --git a/alethzero/DappLoader.cpp b/alethzero/DappLoader.cpp index 69286c5a3..9baf0c82e 100644 --- a/alethzero/DappLoader.cpp +++ b/alethzero/DappLoader.cpp @@ -193,11 +193,26 @@ Manifest DappLoader::loadManifest(std::string const& _manifest) void DappLoader::loadDapp(QString const& _uri) { + QUrl uri(_uri); QUrl contentUri; - DappLocation location = resolveAppUri(_uri); - QUrl uri(location.contentUri); - QNetworkRequest request(uri); - m_uriHashes[uri] = location.contentHash; + h256 hash; + if (uri.path().endsWith(".dapp") && uri.query().startsWith("hash=")) + { + contentUri = uri; + QString query = uri.query(); + query.remove("hash="); + if (!query.startsWith("0x")) + query.insert(0, "0x"); + hash = jsToFixed<32>(query.toStdString()); + } + else + { + DappLocation location = resolveAppUri(_uri); + contentUri = location.contentUri; + hash = location.contentHash; + } + QNetworkRequest request(contentUri); + m_uriHashes[uri] = hash; m_net.get(request); } diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 610fd032d..7e9e65f3d 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -900,7 +900,7 @@ void Main::on_urlEdit_returnPressed() { QString s = ui->urlEdit->text(); QUrl url(s); - if (url.scheme().isEmpty() || url.scheme() == "eth") + if (url.scheme().isEmpty() || url.scheme() == "eth" || url.path().endsWith(".dapp")) { try { diff --git a/mix/ClientModel.cpp b/mix/ClientModel.cpp index 6ba7e54f9..1ed84bbad 100644 --- a/mix/ClientModel.cpp +++ b/mix/ClientModel.cpp @@ -138,6 +138,12 @@ QString ClientModel::newAddress() return QString::fromStdString(toHex(a.secret().ref())); } +QString ClientModel::encodeAbiString(QString _string) +{ + ContractCallDataEncoder encoder; + return QString::fromStdString(toHex(encoder.encodeBytes(_string))); +} + QVariantMap ClientModel::contractAddresses() const { QVariantMap res; diff --git a/mix/ClientModel.h b/mix/ClientModel.h index a5d89d859..6fa4eab9f 100644 --- a/mix/ClientModel.h +++ b/mix/ClientModel.h @@ -154,7 +154,10 @@ public slots: Q_INVOKABLE void debugRecord(unsigned _index); /// Show the debugger for an empty record Q_INVOKABLE void emptyRecord(); + /// Generate new adress Q_INVOKABLE QString newAddress(); + /// Encode a string to ABI parameter. Returns a hex string + Q_INVOKABLE QString encodeAbiString(QString _string); private slots: /// Update UI with machine states result. Display a modal dialog. diff --git a/mix/ContractCallDataEncoder.cpp b/mix/ContractCallDataEncoder.cpp index f1283f433..f991cd36e 100644 --- a/mix/ContractCallDataEncoder.cpp +++ b/mix/ContractCallDataEncoder.cpp @@ -110,11 +110,6 @@ unsigned ContractCallDataEncoder::encodeSingleItem(QVariant const& _data, Solidi return dataSize; } -void ContractCallDataEncoder::push(bytes const& _b) -{ - m_encodedData.insert(m_encodedData.end(), _b.begin(), _b.end()); -} - bigint ContractCallDataEncoder::decodeInt(dev::bytes const& _rawValue) { dev::u256 un = dev::fromBigEndian(_rawValue); diff --git a/mix/ContractCallDataEncoder.h b/mix/ContractCallDataEncoder.h index e225158c7..50c28ea3b 100644 --- a/mix/ContractCallDataEncoder.h +++ b/mix/ContractCallDataEncoder.h @@ -52,8 +52,10 @@ public: QVariant decode(SolidityType const& _type, bytes const& _value); /// Get all encoded data encoded by encode function. bytes encodedData(); - /// Push the given @a _b to the current param context. - void push(bytes const& _b); + /// Encode a string to ABI bytes + dev::bytes encodeBytes(QString const& _str); + /// Decode bytes from ABI + dev::bytes decodeBytes(dev::bytes const& _rawValue); private: unsigned encodeSingleItem(QVariant const& _data, SolidityType const& _type, bytes& _dest); @@ -63,8 +65,6 @@ private: dev::bytes encodeBool(QString const& _str); bool decodeBool(dev::bytes const& _rawValue); QString toString(bool _b); - dev::bytes encodeBytes(QString const& _str); - dev::bytes decodeBytes(dev::bytes const& _rawValue); QString toString(dev::bytes const& _b); bool asString(dev::bytes const& _b, QString& _str); diff --git a/mix/FileIo.cpp b/mix/FileIo.cpp index 58668cad6..6d3d9c1c3 100644 --- a/mix/FileIo.cpp +++ b/mix/FileIo.cpp @@ -196,6 +196,7 @@ QStringList FileIo::makePackage(QString const& _deploymentFolder) QStringList ret; ret.append(QString::fromStdString(toHex(dappHash.ref()))); ret.append(qFileBytes.toBase64()); + ret.append(url.toString()); return ret; } diff --git a/mix/qml/DeploymentDialog.qml b/mix/qml/DeploymentDialog.qml index f5c10bd40..d0b884575 100644 --- a/mix/qml/DeploymentDialog.qml +++ b/mix/qml/DeploymentDialog.qml @@ -24,7 +24,8 @@ Window { visible: false property alias applicationUrlEth: applicationUrlEth.text property alias applicationUrlHttp: applicationUrlHttp.text - property string urlHintContract: urlHintAddr.text + property alias urlHintContract: urlHintAddr.text + property alias localPackageUrl: localPackageUrl.text property string packageHash property string packageBase64 property string eth: registrarAddr.text @@ -299,7 +300,7 @@ Window { DefaultTextField { - text: "20000" + text: "1000000" Layout.preferredWidth: 350 id: gasToUseInput } @@ -416,6 +417,20 @@ Window { columns: 2 Layout.fillWidth: true + DefaultLabel + { + Layout.preferredWidth: 355 + text: qsTr("Local package URL") + } + + DefaultTextField + { + Layout.preferredWidth: 350 + id: localPackageUrl + //readOnly: true + //enabled: rowRegister.isOkToRegister() + } + DefaultLabel { Layout.preferredWidth: 355 diff --git a/mix/qml/ProjectModel.qml b/mix/qml/ProjectModel.qml index ec7681f16..7583c9e71 100644 --- a/mix/qml/ProjectModel.qml +++ b/mix/qml/ProjectModel.qml @@ -158,7 +158,7 @@ Item { } MessageDialog { - id: deployRessourcesDialog + id: deployResourcesDialog title: qsTr("Project") standardButtons: StandardButton.Ok } diff --git a/mix/qml/js/ProjectModel.js b/mix/qml/js/ProjectModel.js index 1ad90c82b..80c5d5989 100644 --- a/mix/qml/js/ProjectModel.js +++ b/mix/qml/js/ProjectModel.js @@ -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); }); } @@ -461,6 +446,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 +454,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(); }); } @@ -617,12 +602,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_sendTransaction", - params: [ { "from": deploymentDialog.currentAccount, "gas": 30000, "gasPrice": "10", "to": '0x' + registrar, "data": "0x5d574e32" + paramTitle.encodeValueAsString() + deploymentDialog.packageHash } ], + params: [ { "from": deploymentDialog.currentAccount, "gas": 30000, "gasPrice": "10", "to": '0x' + registrar, "data": "0x5d574e32" + paramTitle + deploymentDialog.packageHash } ], id: jsonRpcRequestId++ }); rpcCall(requests, function (httpRequest, response) { diff --git a/mix/qml/js/QEtherHelper.js b/mix/qml/js/QEtherHelper.js index 71ee258c3..7563941d2 100644 --- a/mix/qml/js/QEtherHelper.js +++ b/mix/qml/js/QEtherHelper.js @@ -15,19 +15,3 @@ function createBigInt(_value) return bigint; } -function createString(_value) -{ - var stringComponent = Qt.createComponent("qrc:/qml/QStringType.qml"); - var stringC = stringComponent.createObject(); - stringC.setValue(_value); - return stringC; -} - -function createHash(_value) -{ - var hComponent = Qt.createComponent("qrc:/qml/QHashType.qml"); - var hC = hComponent.createObject(); - hC.setValue(_value); - return hC; -} - From 06451b5e4f250404a1c60467c6c9ca7a672fd76c Mon Sep 17 00:00:00 2001 From: arkpar Date: Sun, 5 Apr 2015 18:38:22 +0200 Subject: [PATCH 3/4] deployment bug fixes --- mix/CMakeLists.txt | 2 +- mix/MixApplication.cpp | 5 ++- mix/Web3Server.cpp | 84 +++++++++++++++++++++++++++++++++++++- mix/Web3Server.h | 2 + mix/qml/LogsPane.qml | 4 -- mix/qml/StatusPane.qml | 6 ++- mix/qml/WebPreview.qml | 1 + mix/qml/js/ProjectModel.js | 3 +- 8 files changed, 97 insertions(+), 10 deletions(-) diff --git a/mix/CMakeLists.txt b/mix/CMakeLists.txt index 72e77b523..6a434534f 100644 --- a/mix/CMakeLists.txt +++ b/mix/CMakeLists.txt @@ -29,7 +29,7 @@ else() qt5_add_resources(UI_RESOURCES noweb.qrc) endif() -if (CMAKE_BUILD_TYPE EQUAL "DEBUG") +if (CMAKE_BUILD_TYPE MATCHES Debug) add_definitions(-DQT_QML_DEBUG) endif() diff --git a/mix/MixApplication.cpp b/mix/MixApplication.cpp index 80929dc49..b11b825fb 100644 --- a/mix/MixApplication.cpp +++ b/mix/MixApplication.cpp @@ -36,6 +36,7 @@ #include "Clipboard.h" #include "HttpServer.h" +extern int qInitResources_js(); using namespace dev::mix; ApplicationService::ApplicationService() @@ -59,7 +60,6 @@ MixApplication::MixApplication(int& _argc, char* _argv[]): } } - void MixApplication::initialize() { #if __linux @@ -72,6 +72,9 @@ void MixApplication::initialize() if (!getenv("OPENSSL_CONF")) putenv((char*)"OPENSSL_CONF=c:\\"); #endif +#ifdef ETH_HAVE_WEBENGINE + qInitResources_js(); +#endif setOrganizationName(tr("Ethereum")); setOrganizationDomain(tr("ethereum.org")); diff --git a/mix/Web3Server.cpp b/mix/Web3Server.cpp index 3de2d7ef8..4acb262df 100644 --- a/mix/Web3Server.cpp +++ b/mix/Web3Server.cpp @@ -23,13 +23,93 @@ #include #include #include +#include #include "Web3Server.h" using namespace dev::mix; +using namespace dev; + +namespace +{ +class EmptyNetwork : public dev::WebThreeNetworkFace +{ + std::vector peers() override + { + return std::vector(); + } + + size_t peerCount() const override + { + return 0; + } + + void addNode(p2p::NodeId const& _node, bi::tcp::endpoint const& _hostEndpoint) override + { + (void)_node; + (void)_hostEndpoint; + } + + void requirePeer(p2p::NodeId const& _node, bi::tcp::endpoint const& _endpoint) override + { + (void)_node; + (void)_endpoint; + } + + dev::bytes saveNetwork() override + { + return dev::bytes(); + } + + void setIdealPeerCount(size_t _n) override + { + (void)_n; + } + + bool haveNetwork() const override + { + return false; + } + + void setNetworkPreferences(p2p::NetworkPreferences const& _n, bool _dropPeers) override + { + (void)_n; + (void)_dropPeers; + } + + p2p::NodeId id() const override + { + return p2p::NodeId(); + } + + p2p::Peers nodes() const override + { + return p2p::Peers(); + } + + void startNetwork() override + { + } + + void stopNetwork() override + { + } + + bool isNetworkStarted() const override + { + return false; + } +}; + +} Web3Server::Web3Server(jsonrpc::AbstractServerConnector& _conn, std::vector const& _accounts, dev::eth::Interface* _client): WebThreeStubServerBase(_conn, _accounts), - m_client(_client) + m_client(_client), + m_network(new EmptyNetwork()) +{ +} + +Web3Server::~Web3Server() { } @@ -40,7 +120,7 @@ std::shared_ptr Web3Server::face() dev::WebThreeNetworkFace* Web3Server::network() { - BOOST_THROW_EXCEPTION(InterfaceNotSupported("dev::WebThreeNetworkFace")); + return m_network.get(); } std::string Web3Server::get(std::string const& _name, std::string const& _key) diff --git a/mix/Web3Server.h b/mix/Web3Server.h index 71e2131ba..cfe5c889e 100644 --- a/mix/Web3Server.h +++ b/mix/Web3Server.h @@ -39,6 +39,7 @@ class Web3Server: public QObject, public dev::WebThreeStubServerBase, public dev public: Web3Server(jsonrpc::AbstractServerConnector& _conn, std::vector const& _accounts, dev::eth::Interface* _client); + virtual ~Web3Server(); signals: void newTransaction(); @@ -60,6 +61,7 @@ private: private: dev::eth::Interface* m_client; std::map m_db; + std::unique_ptr m_network; }; } diff --git a/mix/qml/LogsPane.qml b/mix/qml/LogsPane.qml index 7adff8785..d8d73ac0c 100644 --- a/mix/qml/LogsPane.qml +++ b/mix/qml/LogsPane.qml @@ -27,10 +27,6 @@ Rectangle } } - LogsPaneStyle { - id: logStyle - } - anchors.fill: parent radius: 10 color: "transparent" diff --git a/mix/qml/StatusPane.qml b/mix/qml/StatusPane.qml index ef7167b43..a1f3ebe13 100644 --- a/mix/qml/StatusPane.qml +++ b/mix/qml/StatusPane.qml @@ -231,7 +231,11 @@ Rectangle { top = top.parent var coordinates = logsContainer.mapToItem(top, 0, 0); logsContainer.parent = top; - logsContainer.x = status.x + statusContainer.x - LogsPaneStyle.generic.layout.dateWidth - LogsPaneStyle.generic.layout.typeWidth + 70 + logsContainer.x = status.x + statusContainer.x - logStyle.generic.layout.dateWidth - logStyle.generic.layout.typeWidth + 70 + } + + LogsPaneStyle { + id: logStyle } LogsPane diff --git a/mix/qml/WebPreview.qml b/mix/qml/WebPreview.qml index 44b7e6c23..d2b52be65 100644 --- a/mix/qml/WebPreview.qml +++ b/mix/qml/WebPreview.qml @@ -304,6 +304,7 @@ Item { id: webView experimental.settings.localContentCanAccessRemoteUrls: true onJavaScriptConsoleMessage: { + console.log(sourceID + ":" + lineNumber + ": " + message); webPreview.javaScriptMessage(level, sourceID, lineNumber, message); } onLoadingChanged: { diff --git a/mix/qml/js/ProjectModel.js b/mix/qml/js/ProjectModel.js index 80c5d5989..de0bcb5a0 100644 --- a/mix/qml/js/ProjectModel.js +++ b/mix/qml/js/ProjectModel.js @@ -437,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; From c500e367e23d70f7aa294fd098f9150382f2d46a Mon Sep 17 00:00:00 2001 From: arkpar Date: Sun, 5 Apr 2015 18:41:29 +0200 Subject: [PATCH 4/4] style --- alethzero/DappLoader.h | 1 - mix/qml/DeploymentDialog.qml | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/alethzero/DappLoader.h b/alethzero/DappLoader.h index 3e0b30714..463b65d0a 100644 --- a/alethzero/DappLoader.h +++ b/alethzero/DappLoader.h @@ -90,6 +90,5 @@ private: dev::WebThreeDirect* m_web3; QNetworkAccessManager m_net; std::map m_uriHashes; - bool m_skipHashVerification = false; }; diff --git a/mix/qml/DeploymentDialog.qml b/mix/qml/DeploymentDialog.qml index 6d0bd2b26..e8af2f664 100644 --- a/mix/qml/DeploymentDialog.qml +++ b/mix/qml/DeploymentDialog.qml @@ -427,8 +427,8 @@ Window { { Layout.preferredWidth: 350 id: localPackageUrl - //readOnly: true - //enabled: rowRegister.isOkToRegister() + readOnly: true + enabled: rowRegister.isOkToRegister() } DefaultLabel