Skip to content

Commit 9a11a94

Browse files
committed
Updated assets & moved messages
1 parent cbf162c commit 9a11a94

File tree

9 files changed

+81
-65
lines changed

9 files changed

+81
-65
lines changed

cmd/mist/assets/ext/big.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
1616
// MA 02110-1301 USA
1717

18-
var bigInt = (function () {
18+
var BigNumber = (function () {
1919
var base = 10000000, logBase = 7;
2020
var sign = {
2121
positive: false,
@@ -73,7 +73,7 @@ var bigInt = (function () {
7373
var isValid = (base == 16 ? /^[0-9A-F]*$/ : /^[0-9]+$/).test(text);
7474
if (!isValid) throw new Error("Invalid integer");
7575
if (base == 16) {
76-
var val = bigInt(0);
76+
var val = BigNumber(0);
7777
while (text.length) {
7878
v = text.charCodeAt(0) - 48;
7979
if (v > 9)
@@ -89,19 +89,19 @@ var bigInt = (function () {
8989
value.push(+text.slice(divider));
9090
text = text.slice(0, divider);
9191
}
92-
var val = bigInt(value, s);
92+
var val = BigNumber(value, s);
9393
if (first) normalize(first, val);
9494
return val;
9595
}
9696
};
9797

9898
var goesInto = function (a, b) {
99-
var a = bigInt(a, sign.positive), b = bigInt(b, sign.positive);
99+
var a = BigNumber(a, sign.positive), b = BigNumber(b, sign.positive);
100100
if (a.equals(0)) throw new Error("Cannot divide by 0");
101101
var n = 0;
102102
do {
103103
var inc = 1;
104-
var c = bigInt(a.value, sign.positive), t = c.times(10);
104+
var c = BigNumber(a.value, sign.positive), t = c.times(10);
105105
while (t.lesser(b)) {
106106
c = t;
107107
inc *= 10;
@@ -119,7 +119,7 @@ var bigInt = (function () {
119119
};
120120
};
121121

122-
var bigInt = function (value, s) {
122+
var BigNumber = function (value, s) {
123123
var self = {
124124
value: value,
125125
sign: s
@@ -129,20 +129,20 @@ var bigInt = (function () {
129129
sign: s,
130130
negate: function (m) {
131131
var first = m || self;
132-
return bigInt(first.value, !first.sign);
132+
return BigNumber(first.value, !first.sign);
133133
},
134134
abs: function (m) {
135135
var first = m || self;
136-
return bigInt(first.value, sign.positive);
136+
return BigNumber(first.value, sign.positive);
137137
},
138138
add: function (n, m) {
139139
var s, first = self, second;
140140
if (m) (first = parse(n)) && (second = parse(m));
141141
else second = parse(n, first);
142142
s = first.sign;
143143
if (first.sign !== second.sign) {
144-
first = bigInt(first.value, sign.positive);
145-
second = bigInt(second.value, sign.positive);
144+
first = BigNumber(first.value, sign.positive);
145+
second = BigNumber(second.value, sign.positive);
146146
return s === sign.positive ?
147147
o.subtract(first, second) :
148148
o.subtract(second, first);
@@ -157,7 +157,7 @@ var bigInt = (function () {
157157
sum -= carry * base;
158158
result.push(sum);
159159
}
160-
return bigInt(result, s);
160+
return BigNumber(result, s);
161161
},
162162
plus: function (n, m) {
163163
return o.add(n, m);
@@ -178,7 +178,7 @@ var bigInt = (function () {
178178
var minuend = (borrow * base) + tmp - b[i];
179179
result.push(minuend);
180180
}
181-
return bigInt(result, sign.positive);
181+
return BigNumber(result, sign.positive);
182182
},
183183
minus: function (n, m) {
184184
return o.subtract(n, m);
@@ -223,7 +223,7 @@ var bigInt = (function () {
223223
sum -= carry * base;
224224
result.push(sum);
225225
}
226-
return bigInt(result, s);
226+
return BigNumber(result, s);
227227
},
228228
times: function (n, m) {
229229
return o.multiply(n, m);
@@ -233,9 +233,9 @@ var bigInt = (function () {
233233
if (m) (first = parse(n)) && (second = parse(m));
234234
else second = parse(n, first);
235235
s = first.sign !== second.sign;
236-
if (bigInt(first.value, first.sign).equals(0)) return {
237-
quotient: bigInt([0], sign.positive),
238-
remainder: bigInt([0], sign.positive)
236+
if (BigNumber(first.value, first.sign).equals(0)) return {
237+
quotient: BigNumber([0], sign.positive),
238+
remainder: BigNumber([0], sign.positive)
239239
};
240240
if (second.equals(0)) throw new Error("Cannot divide by zero");
241241
var a = first.value, b = second.value;
@@ -248,8 +248,8 @@ var bigInt = (function () {
248248
}
249249
result.reverse();
250250
return {
251-
quotient: bigInt(result, s),
252-
remainder: bigInt(remainder, first.sign)
251+
quotient: BigNumber(result, s),
252+
remainder: BigNumber(remainder, first.sign)
253253
};
254254
},
255255
divide: function (n, m) {
@@ -268,7 +268,7 @@ var bigInt = (function () {
268268
var a = first, b = second;
269269
if (b.lesser(0)) return ZERO;
270270
if (b.equals(0)) return ONE;
271-
var result = bigInt(a.value, a.sign);
271+
var result = BigNumber(a.value, a.sign);
272272

273273
if (b.mod(2).equals(0)) {
274274
var c = result.pow(b.over(2));
@@ -377,9 +377,9 @@ var bigInt = (function () {
377377
return o;
378378
};
379379

380-
var ZERO = bigInt([0], sign.positive);
381-
var ONE = bigInt([1], sign.positive);
382-
var MINUS_ONE = bigInt([1], sign.negative);
380+
var ZERO = BigNumber([0], sign.positive);
381+
var ONE = BigNumber([1], sign.positive);
382+
var MINUS_ONE = BigNumber([1], sign.negative);
383383

384384
var fnReturn = function (a) {
385385
if (typeof a === "undefined") return ZERO;
@@ -392,6 +392,6 @@ var bigInt = (function () {
392392
})();
393393

394394
if (typeof module !== "undefined") {
395-
module.exports = bigInt;
395+
module.exports = BigNumber;
396396
}
397397

cmd/mist/assets/ext/dist/ethereum.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mist/assets/ext/example/balance.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
<html>
33

44
<head>
5-
<script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script>
5+
<script type="text/javascript" src="../bignumber.min.js"></script>
66
<script type="text/javascript" src="../dist/ethereum.js"></script>
77
<script type="text/javascript">
88

9+
console.log("hello world");
910
var web3 = require('web3');
11+
console.log(web3)
1012
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
1113

1214
function watchBalance() {
@@ -25,6 +27,11 @@
2527
});
2628
}
2729

30+
var request = new XMLHttpRequest();
31+
request.open('POST', "http://localhost:8080", false);
32+
request.send({});
33+
34+
2835
</script>
2936
</head>
3037
<body>

cmd/mist/assets/qml/main.qml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ ApplicationWindow {
4545

4646
mainSplit.setView(wallet.view, wallet.menuItem);
4747

48-
try {
49-
newBrowserTab("http://google.com");
50-
} catch(e) { console.log(e); }
48+
console.log("starting browser")
49+
newBrowserTab("http://etherian.io");
50+
console.log("done")
5151

5252
// Command setup
5353
gui.sendCommand(0)

cmd/mist/assets/qml/views/browser2.qml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import QtQuick 2.0
2-
import QtWebEngine 1.0
3-
//import QtWebEngine.experimental 1.0
42
import QtQuick.Controls 1.0;
53
import QtQuick.Controls.Styles 1.0
64
import QtQuick.Layouts 1.0;
5+
import QtWebEngine 1.0
6+
//import QtWebEngine.experimental 1.0
77
import QtQuick.Window 2.0;
8-
import Ethereum 1.0
98

109
Rectangle {
1110
id: window
@@ -64,17 +63,6 @@ Rectangle {
6463
}
6564

6665
Component.onCompleted: {
67-
webview.url = "http://etherian.io"
68-
}
69-
70-
function messages(messages, id) {
71-
// Bit of a cheat to get proper JSON
72-
var m = JSON.parse(JSON.parse(JSON.stringify(messages)))
73-
webview.postEvent("eth_changed", id, m);
74-
}
75-
76-
function onShhMessage(message, id) {
77-
webview.postEvent("shh_changed", id, message)
7866
}
7967

8068
Item {
@@ -129,6 +117,8 @@ Rectangle {
129117
}
130118
iconSource: "../../bug.png"
131119
onClicked: {
120+
// XXX soon
121+
return
132122
if(inspector.visible == true){
133123
inspector.visible = false
134124
}else{
@@ -155,13 +145,23 @@ Rectangle {
155145
WebEngineView {
156146
objectName: "webView"
157147
id: webview
158-
// anchors.fill: parent
159148
anchors {
160149
left: parent.left
161150
right: parent.right
162151
bottom: parent.bottom
163152
top: divider.bottom
164153
}
154+
155+
onLoadingChanged: {
156+
console.log(url)
157+
if (loadRequest.status == WebEngineView.LoadSucceededStatus) {
158+
webview.runJavaScript(eth.readFile("bignumber.min.js"));
159+
webview.runJavaScript(eth.readFile("dist/ethereum.js"));
160+
}
161+
}
162+
onJavaScriptConsoleMessage: {
163+
console.log(sourceID + ":" + lineNumber + ":" + JSON.stringify(message));
164+
}
165165
}
166166

167167
Rectangle {
@@ -193,6 +193,7 @@ Rectangle {
193193
top: sizeGrip.bottom
194194
bottom: root.bottom
195195
}
196+
196197
}
197198

198199
states: [

cmd/mist/ext_app.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@
2121
package main
2222

2323
import (
24-
"encoding/json"
25-
2624
"github.com/ethereum/go-ethereum/core"
2725
"github.com/ethereum/go-ethereum/core/types"
2826
"github.com/ethereum/go-ethereum/event"
29-
"github.com/ethereum/go-ethereum/javascript"
3027
"github.com/ethereum/go-ethereum/state"
3128
"github.com/ethereum/go-ethereum/ui/qt"
3229
"github.com/ethereum/go-ethereum/xeth"
@@ -113,13 +110,15 @@ func (app *ExtApplication) mainLoop() {
113110
case core.NewBlockEvent:
114111
app.container.NewBlock(ev.Block)
115112

116-
case state.Messages:
117-
for id, filter := range app.filters {
118-
msgs := filter.FilterMessages(ev)
119-
if len(msgs) > 0 {
120-
app.container.Messages(msgs, id)
113+
/* TODO remove
114+
case state.Messages:
115+
for id, filter := range app.filters {
116+
msgs := filter.FilterMessages(ev)
117+
if len(msgs) > 0 {
118+
app.container.Messages(msgs, id)
119+
}
121120
}
122-
}
121+
*/
123122
}
124123
}
125124
}
@@ -129,6 +128,7 @@ func (self *ExtApplication) Watch(filterOptions map[string]interface{}, identifi
129128
}
130129

131130
func (self *ExtApplication) GetMessages(object map[string]interface{}) string {
131+
/* TODO remove me
132132
filter := qt.NewFilterFromMap(object, self.eth)
133133
134134
messages := filter.Find()
@@ -143,4 +143,6 @@ func (self *ExtApplication) GetMessages(object map[string]interface{}) string {
143143
}
144144
145145
return string(b)
146+
*/
147+
return ""
146148
}

cmd/mist/gui.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -398,14 +398,6 @@ func (gui *Gui) setup() {
398398
gui.setPeerInfo()
399399
}()
400400

401-
// Inject javascript files each time navigation is requested.
402-
// Unfortunately webview.experimental.userScripts injects _after_
403-
// the page has loaded which kind of renders it useless...
404-
//jsfiles := loadJavascriptAssets(gui)
405-
gui.getObjectByName("webView").On("navigationRequested", func() {
406-
//gui.getObjectByName("webView").Call("injectJs", jsfiles)
407-
})
408-
409401
gui.whisper.SetView(gui.getObjectByName("whisperView"))
410402

411403
gui.SendCommand(update)

cmd/mist/html_container.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
package main
2222

2323
import (
24-
"encoding/json"
2524
"errors"
2625
"fmt"
2726
"io/ioutil"
@@ -32,7 +31,6 @@ import (
3231

3332
"github.com/ethereum/go-ethereum/core/types"
3433
"github.com/ethereum/go-ethereum/ethutil"
35-
"github.com/ethereum/go-ethereum/javascript"
3634
"github.com/ethereum/go-ethereum/state"
3735
"github.com/ethereum/go-ethereum/xeth"
3836
"github.com/howeyc/fsnotify"
@@ -147,6 +145,7 @@ func (app *HtmlApplication) NewBlock(block *types.Block) {
147145
}
148146

149147
func (self *HtmlApplication) Messages(messages state.Messages, id string) {
148+
/* TODO remove me
150149
var msgs []javascript.JSMessage
151150
for _, m := range messages {
152151
msgs = append(msgs, javascript.NewJSMessage(m))
@@ -155,6 +154,7 @@ func (self *HtmlApplication) Messages(messages state.Messages, id string) {
155154
b, _ := json.Marshal(msgs)
156155
157156
self.webView.Call("onWatchedCb", string(b), id)
157+
*/
158158
}
159159

160160
func (app *HtmlApplication) Destroy() {

0 commit comments

Comments
 (0)