Fixed setting providers to the right object
This commit is contained in:
parent
76b20be2ea
commit
8a7d1a69b3
@ -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);
|
||||
|
4
qt.js
4
qt.js
@ -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;
|
||||
}
|
||||
})();
|
||||
|
||||
|
@ -46,6 +46,6 @@
|
||||
});
|
||||
|
||||
if(typeof(web3) !== "undefined" && web3.providers !== undefined) {
|
||||
web3.WebSocketProvider = WebSocketProvider;
|
||||
web3.providers.WebSocketProvider = WebSocketProvider;
|
||||
}
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user