diff options
-rw-r--r-- | index.html | 7 | ||||
-rw-r--r-- | qt.js | 4 | ||||
-rw-r--r-- | websocket.js | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/index.html b/index.html index c4f989537..fc658c00a 100644 --- a/index.html +++ b/index.html @@ -3,12 +3,15 @@ <head> <script type="text/javascript" src="main.js"></script> +<script type="text/javascript" src="websocket.js"></script> +<script type="text/javascript" src="qt.js"></script> <script type="text/javascript"> function registerName() { var name = document.querySelector("#name").value; - name = eth.fromAscii(name); + name = web3.fromAscii(name); - eth.transact({to: "NameReg", gas: "10000", gasPrice: eth.gasPrice, data: [eth.fromAscii("register"), name]}).then(function(tx) { + var eth = web3.eth; + eth.transact({to: "NameReg", gas: "10000", gasPrice: eth.gasPrice, data: [web3.fromAscii("register"), name]}).then(function(tx) { document.querySelector("#result").innerHTML = "Registered name. Please wait for the next block to come through."; }, function(err) { console.log(err); @@ -3,6 +3,7 @@ QtProvider.prototype.send = function(payload) { navigator.qt.postData(JSON.stringify(payload)); }; + Object.defineProperty(QtProvider.prototype, "onmessage", { set: function(handler) { navigator.qt.onmessage = handler; @@ -10,6 +11,7 @@ }); if(typeof(web3) !== "undefined" && web3.providers !== undefined) { - web3.QtProvider = QtProvider; + web3.providers.QtProvider = QtProvider; } })(); + diff --git a/websocket.js b/websocket.js index e06d127e8..297690b33 100644 --- a/websocket.js +++ b/websocket.js @@ -46,6 +46,6 @@ }); if(typeof(web3) !== "undefined" && web3.providers !== undefined) { - web3.WebSocketProvider = WebSocketProvider; + web3.providers.WebSocketProvider = WebSocketProvider; } })(); |