|
@ -4,7 +4,7 @@ go:
|
|||
before_install:
|
||||
- sudo add-apt-repository ppa:beineri/opt-qt541 -y
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -yqq libgmp3-dev qt54quickcontrols qt54webengine
|
||||
- sudo apt-get install -yqq libgmp3-dev
|
||||
install:
|
||||
# - go get code.google.com/p/go.tools/cmd/goimports
|
||||
# - go get github.com/golang/lint/golint
|
||||
|
|
Before Width: | Height: | Size: 1004 B |
Before Width: | Height: | Size: 663 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 634 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 657 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 756 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 905 B |
|
@ -1,436 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Layouts 1.0;
|
||||
import QtQuick.Dialogs 1.0;
|
||||
import QtQuick.Window 2.1;
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import Ethereum 1.0
|
||||
|
||||
ApplicationWindow {
|
||||
id: win
|
||||
visible: false
|
||||
title: "IceCREAM"
|
||||
minimumWidth: 1280
|
||||
minimumHeight: 700
|
||||
width: 1290
|
||||
height: 750
|
||||
|
||||
property alias codeText: codeEditor.text
|
||||
property alias dataText: rawDataField.text
|
||||
|
||||
onClosing: {
|
||||
//dbg.Stop()
|
||||
}
|
||||
|
||||
menuBar: MenuBar {
|
||||
Menu {
|
||||
title: "Edit"
|
||||
MenuItem {
|
||||
text: "Focus code"
|
||||
shortcut: "Ctrl+1"
|
||||
onTriggered: {
|
||||
codeEditor.focus = true
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: "Focus data"
|
||||
shortcut: "Ctrl+2"
|
||||
onTriggered: {
|
||||
rawDataField.focus = true
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Command"
|
||||
shortcut: "Ctrl+l"
|
||||
onTriggered: {
|
||||
dbgCommand.focus = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: "Debugger"
|
||||
MenuItem {
|
||||
text: "Run"
|
||||
shortcut: "Ctrl+r"
|
||||
onTriggered: debugCurrent()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Stop"
|
||||
onTriggered: dbp.stop()
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
MenuItem {
|
||||
text: "Next"
|
||||
shortcut: "Ctrl+n"
|
||||
onTriggered: dbg.next()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Continue"
|
||||
shortcut: "Ctrl+g"
|
||||
onTriggered: dbg.continue()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SplitView {
|
||||
anchors.fill: parent
|
||||
property var asmModel: ListModel {
|
||||
id: asmModel
|
||||
}
|
||||
|
||||
TableView {
|
||||
id: asmTableView
|
||||
width: 200
|
||||
headerVisible: false
|
||||
TableViewColumn{ role: "value" ; title: "" ; width: asmTableView.width - 2 }
|
||||
model: asmModel
|
||||
/*
|
||||
alternatingRowColors: false
|
||||
itemDelegate: Item {
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "#DDD"
|
||||
Text {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 10
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
color: "#333"
|
||||
elide: styleData.elideMode
|
||||
text: styleData.value
|
||||
font.pixelSize: 11
|
||||
MouseArea {
|
||||
acceptedButtons: Qt.LeftButton
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
mouse.accepted = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: "#00000000"
|
||||
anchors.left: asmTableView.right
|
||||
anchors.right: parent.right
|
||||
SplitView {
|
||||
orientation: Qt.Vertical
|
||||
anchors.fill: parent
|
||||
|
||||
Rectangle {
|
||||
color: "#00000000"
|
||||
height: 330
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
TextArea {
|
||||
id: codeEditor
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: settings.left
|
||||
focus: true
|
||||
|
||||
/*
|
||||
Timer {
|
||||
id: compileTimer
|
||||
interval: 500 ; running: true ; repeat: true
|
||||
onTriggered: {
|
||||
dbg.autoComp(codeEditor.text)
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
Column {
|
||||
id: settings
|
||||
spacing: 5
|
||||
width: 300
|
||||
height: parent.height
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
Label {
|
||||
text: "Arbitrary data"
|
||||
}
|
||||
TextArea {
|
||||
id: rawDataField
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
height: 150
|
||||
}
|
||||
|
||||
Label {
|
||||
text: "Amount"
|
||||
}
|
||||
TextField {
|
||||
id: txValue
|
||||
width: 200
|
||||
placeholderText: "Amount"
|
||||
validator: RegExpValidator { regExp: /\d*/ }
|
||||
}
|
||||
Label {
|
||||
text: "Amount of gas"
|
||||
}
|
||||
TextField {
|
||||
id: txGas
|
||||
width: 200
|
||||
validator: RegExpValidator { regExp: /\d*/ }
|
||||
text: "10000"
|
||||
placeholderText: "Gas"
|
||||
}
|
||||
Label {
|
||||
text: "Gas price"
|
||||
}
|
||||
TextField {
|
||||
id: txGasPrice
|
||||
width: 200
|
||||
placeholderText: "Gas price"
|
||||
text: "1000000000000"
|
||||
validator: RegExpValidator { regExp: /\d*/ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SplitView {
|
||||
orientation: Qt.Vertical
|
||||
id: inspectorPane
|
||||
height: 500
|
||||
|
||||
SplitView {
|
||||
orientation: Qt.Horizontal
|
||||
height: 150
|
||||
|
||||
TableView {
|
||||
id: stackTableView
|
||||
property var stackModel: ListModel {
|
||||
id: stackModel
|
||||
}
|
||||
height: parent.height
|
||||
width: 300
|
||||
TableViewColumn{ role: "value" ; title: "Local VM stack" ; width: stackTableView.width - 2 }
|
||||
model: stackModel
|
||||
}
|
||||
|
||||
TableView {
|
||||
id: memoryTableView
|
||||
property var memModel: ListModel {
|
||||
id: memModel
|
||||
}
|
||||
height: parent.height
|
||||
width: parent.width - stackTableView.width
|
||||
TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50 }
|
||||
TableViewColumn{ role: "value" ; title: "Memory" ; width: 650 }
|
||||
model: memModel
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: 100
|
||||
width: parent.width
|
||||
TableView {
|
||||
id: storageTableView
|
||||
property var memModel: ListModel {
|
||||
id: storageModel
|
||||
}
|
||||
height: parent.height
|
||||
width: parent.width
|
||||
TableViewColumn{ id: key ; role: "key" ; title: "#" ; width: storageTableView.width / 2 - 1}
|
||||
TableViewColumn{ role: "value" ; title: "Storage" ; width: storageTableView.width / 2 - 1}
|
||||
model: storageModel
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: 200
|
||||
width: parent.width * 0.66
|
||||
TableView {
|
||||
id: logTableView
|
||||
property var logModel: ListModel {
|
||||
id: logModel
|
||||
}
|
||||
height: parent.height
|
||||
width: parent.width
|
||||
TableViewColumn{ id: message ; role: "message" ; title: "log" ; width: logTableView.width - 2 }
|
||||
model: logModel
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function exec() {
|
||||
dbg.execCommand(dbgCommand.text);
|
||||
dbgCommand.text = "";
|
||||
}
|
||||
statusBar: StatusBar {
|
||||
height: 30
|
||||
|
||||
|
||||
TextField {
|
||||
id: dbgCommand
|
||||
y: 1
|
||||
x: asmTableView.width
|
||||
width: 500
|
||||
placeholderText: "Debugger (type 'help')"
|
||||
Keys.onReturnPressed: {
|
||||
exec()
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.left: dbgCommand.right
|
||||
anchors.leftMargin: 10
|
||||
spacing: 5
|
||||
y: parent.height / 2 - this.height / 2
|
||||
|
||||
Text {
|
||||
objectName: "stackFrame"
|
||||
font.pixelSize: 10
|
||||
text: "<b>stack ptr</b>: 0"
|
||||
}
|
||||
|
||||
Text {
|
||||
objectName: "stackSize"
|
||||
font.pixelSize: 10
|
||||
text: "<b>stack size</b>: 0"
|
||||
}
|
||||
|
||||
Text {
|
||||
objectName: "memSize"
|
||||
font.pixelSize: 10
|
||||
text: "<b>mem size</b>: 0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
toolBar: ToolBar {
|
||||
height: 30
|
||||
RowLayout {
|
||||
spacing: 10
|
||||
|
||||
Button {
|
||||
property var enabled: true
|
||||
id: debugStart
|
||||
onClicked: {
|
||||
debugCurrent()
|
||||
}
|
||||
text: "Debug"
|
||||
}
|
||||
|
||||
Button {
|
||||
property var enabled: true
|
||||
id: debugNextButton
|
||||
onClicked: {
|
||||
dbg.next()
|
||||
}
|
||||
text: "Next"
|
||||
}
|
||||
|
||||
Button {
|
||||
id: debugContinueButton
|
||||
onClicked: {
|
||||
dbg.continue()
|
||||
}
|
||||
text: "Continue"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ComboBox {
|
||||
visible: false
|
||||
id: snippets
|
||||
anchors.right: parent.right
|
||||
model: ListModel {
|
||||
ListElement { text: "Snippets" ; value: "" }
|
||||
ListElement { text: "Call Contract" ; value: "var[2] in = { \"arg1\", 0xdeadbeef };\nvar ret;\n\nvar success = call(0x0c542ddea93dae0c2fcb2cf175f03ad80d6be9a0, 0, 7000, in, ret)\n\nreturn ret" }
|
||||
}
|
||||
onCurrentIndexChanged: {
|
||||
if(currentIndex != 0) {
|
||||
var code = snippets.model.get(currentIndex).value;
|
||||
codeEditor.insert(codeEditor.cursorPosition, code)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function debugCurrent() {
|
||||
dbg.debug(txValue.text, txGas.text, txGasPrice.text, codeEditor.text, rawDataField.text)
|
||||
}
|
||||
|
||||
function setAsm(asm) {
|
||||
asmModel.append({asm: asm})
|
||||
}
|
||||
|
||||
function clearAsm() {
|
||||
asmModel.clear()
|
||||
}
|
||||
|
||||
function setInstruction(num) {
|
||||
asmTableView.selection.clear()
|
||||
asmTableView.selection.select(num)
|
||||
asmTableView.positionViewAtRow(num, ListView.Center)
|
||||
}
|
||||
|
||||
function setMem(mem) {
|
||||
memModel.append({num: mem.num, value: mem.value})
|
||||
}
|
||||
function clearMem(){
|
||||
memModel.clear()
|
||||
}
|
||||
|
||||
function setStack(stack) {
|
||||
stackModel.append({value: stack})
|
||||
}
|
||||
function addDebugMessage(message){
|
||||
debuggerLog.append({value: message})
|
||||
}
|
||||
|
||||
function clearStack() {
|
||||
stackModel.clear()
|
||||
}
|
||||
|
||||
function clearStorage() {
|
||||
storageModel.clear()
|
||||
}
|
||||
|
||||
function setStorage(storage) {
|
||||
storageModel.append({key: storage.key, value: storage.value})
|
||||
}
|
||||
|
||||
function setLog(msg) {
|
||||
// Remove first item once we've reached max log items
|
||||
if(logModel.count > 250) {
|
||||
logModel.remove(0)
|
||||
}
|
||||
|
||||
if(msg.len != 0) {
|
||||
if(logTableView.flickableItem.atYEnd) {
|
||||
logModel.append({message: msg})
|
||||
logTableView.positionViewAtRow(logTableView.rowCount - 1, ListView.Contain)
|
||||
} else {
|
||||
logModel.append({message: msg})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clearLog() {
|
||||
logModel.clear()
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
<!doctype>
|
||||
<html>
|
||||
<head>
|
||||
<title>Hello world</title>
|
||||
<script src="../ext/bignumber.min.js"></script>
|
||||
<script src="../ext/ethereum.js/dist/ethereum.js"></script>
|
||||
<script>
|
||||
var web3 = require('web3');
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
|
||||
var eth = web3.eth;
|
||||
var desc = [{
|
||||
"name": "multiply(uint256)",
|
||||
"inputs": [{
|
||||
"name": "a",
|
||||
"type": "uint256"
|
||||
}],
|
||||
"outputs": [{
|
||||
"name": "d",
|
||||
"type": "uint256"
|
||||
}]
|
||||
}];
|
||||
var address = web3.eth.transact({
|
||||
data: "0x603880600c6000396000f3006001600060e060020a600035048063c6888fa114601857005b6021600435602b565b8060005260206000f35b600081600702905091905056",
|
||||
gasPrice: "1000000000000000",
|
||||
gas: "10000",
|
||||
});
|
||||
var contract = web3.eth.contract(address, desc);
|
||||
|
||||
function calculate() {
|
||||
var param = parseInt(document.getElementById('value').value);
|
||||
|
||||
var res = contract.call().multiply(param);
|
||||
document.getElementById('result').innerText = res.toString(10);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h3>Contract content</h3>
|
||||
<textarea style="height:100px; width: 300px;" disabled="disabled">
|
||||
contract test {
|
||||
function multiply(uint a) returns(uint d) {
|
||||
return a * 7;
|
||||
}
|
||||
}
|
||||
</textarea>
|
||||
<code><pre>
|
||||
603880600c6000396000f3006001600060e060020a600035048063c6888fa1140
|
||||
05b6021600435602b565b8060005260206000f35b600081600702905091905056</pre></code>
|
||||
|
||||
<hr>
|
||||
<div>7 x <input type="number" id="value" onkeyup='calculate()'></input> =
|
||||
<span id="result"></spa>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,40 +0,0 @@
|
|||
<!doctype>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<script src="../ext/bignumber.min.js"></script>
|
||||
<script src="../ext/ethereum.js/dist/ethereum.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var web3 = require('web3');
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
|
||||
|
||||
function watchBalance() {
|
||||
var coinbase = web3.eth.coinbase;
|
||||
var originalBalance = 0;
|
||||
|
||||
var balance = web3.eth.balanceAt(coinbase);
|
||||
var originalBalance = web3.toDecimal(balance);
|
||||
document.getElementById('original').innerText = 'original balance: ' + originalBalance + ' watching...';
|
||||
|
||||
web3.eth.watch({altered: coinbase}).changed(function() {
|
||||
balance = web3.eth.balanceAt(coinbase)
|
||||
var currentBalance = web3.toDecimal(balance);
|
||||
document.getElementById("current").innerText = 'current: ' + currentBalance;
|
||||
document.getElementById("diff").innerText = 'diff: ' + (currentBalance - originalBalance);
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>coinbase balance</h1>
|
||||
<button type="button" onClick="watchBalance();">watch balance</button>
|
||||
<div></div>
|
||||
<div id="original"></div>
|
||||
<div id="current"></div>
|
||||
<div id="diff"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="../ext/bignumber.min.js"></script>
|
||||
<script src="../ext/ethereum.js/dist/ethereum.js"></script>
|
||||
|
||||
<script>
|
||||
var web3 = require('web3');
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8545'));
|
||||
var eth = web3.eth;
|
||||
|
||||
function bomb() {
|
||||
for (var i = 0; i < 200; i++) {
|
||||
eth.transact({})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<button onclick="bomb();">BOOM!</button>
|
||||
</body>
|
||||
</html>
|
|
@ -1,147 +0,0 @@
|
|||
<!doctype>
|
||||
<html>
|
||||
<title>JevCoin</title>
|
||||
<head>
|
||||
<script type="text/javascript" src="../ext/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../ext/ethereum.js/dist/web3-light.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>JevCoin <code id="contract_addr"></code></h1>
|
||||
<div>
|
||||
<strong>Balance</strong>
|
||||
<span id="balance"></strong>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span>Address:</span>
|
||||
<input type="text" id="address" style="width:200px">
|
||||
<span>Amount:</span>
|
||||
<input type="text" id="amount" style="width:200px">
|
||||
<button onclick="transact()">Send</button>
|
||||
<span id="message"></span>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<table width="100%" id="table">
|
||||
<tr><td style="width:40%;">Address</td><td>Balance</td></tr>
|
||||
<tbody id="table_body"></tbody>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
var eth = web3.eth;
|
||||
|
||||
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
|
||||
var desc = [{
|
||||
"name": "balance(address)",
|
||||
"type": "function",
|
||||
"inputs": [{
|
||||
"name": "who",
|
||||
"type": "address"
|
||||
}],
|
||||
"constant": true,
|
||||
"outputs": [{
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}]
|
||||
}, {
|
||||
"name": "send(address,uint256)",
|
||||
"type": "function",
|
||||
"inputs": [{
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
}, {
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}],
|
||||
"outputs": []
|
||||
}, {
|
||||
"name":"Changed",
|
||||
"type":"event",
|
||||
"inputs": [
|
||||
{"name":"from","type":"address","indexed":true},
|
||||
{"name":"amount","type":"uint256","indexed":true},
|
||||
],
|
||||
}];
|
||||
|
||||
var address = localStorage.getItem("address");
|
||||
// deploy if not exist
|
||||
if(address === null) {
|
||||
var code = "0x60056013565b61014f8061003a6000396000f35b620f42406000600033600160a060020a0316815260200190815260200160002081905550560060e060020a600035048063d0679d3414610020578063e3d670d71461003457005b61002e600435602435610049565b60006000f35b61003f600435610129565b8060005260206000f35b806000600033600160a060020a03168152602001908152602001600020541061007157610076565b610125565b806000600033600160a060020a03168152602001908152602001600020908154039081905550806000600084600160a060020a031681526020019081526020016000209081540190819055508033600160a060020a03167fb52dda022b6c1a1f40905a85f257f689aa5d69d850e49cf939d688fbe5af594660006000a38082600160a060020a03167fb52dda022b6c1a1f40905a85f257f689aa5d69d850e49cf939d688fbe5af594660006000a35b5050565b60006000600083600160a060020a0316815260200190815260200160002054905091905056";
|
||||
address = web3.eth.sendTransaction({from: eth.accounts[0], data: code, gas: "1000000"});
|
||||
localStorage.setItem("address", address);
|
||||
}
|
||||
document.querySelector("#contract_addr").innerHTML = address;
|
||||
|
||||
var Contract = web3.eth.contract(desc);
|
||||
contract = new Contract(address);
|
||||
var filter = contract.Changed({from: eth.accounts[0]})
|
||||
filter.watch(function(logs) {
|
||||
console.log(logs);
|
||||
refresh();
|
||||
});
|
||||
window.filter = filter;
|
||||
|
||||
function refresh() {
|
||||
document.querySelector("#balance").innerHTML = contract.balance(eth.coinbase);
|
||||
}
|
||||
|
||||
function transact() {
|
||||
var to = document.querySelector("#address");
|
||||
if( to.value.length == 0 ) {
|
||||
to = "0x4205b06c2cfa0e30359edcab94543266cb6fa1d3";
|
||||
} else {
|
||||
if (to.value.substr(0,2) != "0x")
|
||||
to.value = "0x"+to.value;
|
||||
}
|
||||
|
||||
var value = document.querySelector("#amount");
|
||||
var amount = parseInt( value.value );
|
||||
console.log("transact: ", to.value, " => ", amount)
|
||||
|
||||
contract.send.sendTransaction(to.value, amount ,{from: eth.accounts[0]});
|
||||
|
||||
to.value = "";
|
||||
value.value = "";
|
||||
|
||||
var message = document.querySelector("#message")
|
||||
message.innerHTML = "Submitted";
|
||||
setTimeout(function() {
|
||||
message.innerHTML = "";
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
refresh();
|
||||
</script>
|
||||
</html>
|
||||
|
||||
<!--
|
||||
contract JevCoin {
|
||||
function JevCoin()
|
||||
{
|
||||
balances[msg.sender] = 1000000;
|
||||
}
|
||||
|
||||
event Changed(address indexed from, uint indexed amount);
|
||||
function send(address to, uint value)
|
||||
{
|
||||
if( balances[msg.sender] < value ) return;
|
||||
|
||||
balances[msg.sender] -= value;
|
||||
balances[to] += value;
|
||||
|
||||
Changed(msg.sender, value);
|
||||
Changed(to, value);
|
||||
}
|
||||
|
||||
function balance(address who) constant returns(uint t)
|
||||
{
|
||||
t = balances[who];
|
||||
}
|
||||
|
||||
mapping(address => uint256) balances;
|
||||
}
|
||||
-!>
|
|
@ -1,65 +0,0 @@
|
|||
var walletABI = [
|
||||
{
|
||||
"name":"confirm",
|
||||
"type":"function",
|
||||
"constant":false,
|
||||
"inputs":[
|
||||
{"name":"_h","type":"hash256"}
|
||||
],
|
||||
"outputs":[]
|
||||
},{
|
||||
"name":"execute",
|
||||
"constant":false,
|
||||
"type":"function",
|
||||
"inputs":[
|
||||
{"name":"_to","type":"address"},
|
||||
{"name":"_value","type":"uint256"},
|
||||
{"name":"_data","type":"bytes"}
|
||||
],
|
||||
"outputs":[
|
||||
{"name":"_r","type":"hash256"}
|
||||
]
|
||||
},{
|
||||
"name":"kill",
|
||||
"type":"function",
|
||||
"constant":false,
|
||||
"inputs":[
|
||||
{"name":"_to","type":"address"}
|
||||
],
|
||||
"outputs":[]
|
||||
},{
|
||||
"name":"changeOwner",
|
||||
"type":"function",
|
||||
"constant":false,
|
||||
"inputs":[
|
||||
{"name":"_from","type":"address"},
|
||||
{"name":"_to","type":"address"}
|
||||
],
|
||||
"outputs":[]
|
||||
},{
|
||||
"name":"CashIn",
|
||||
"type":"event",
|
||||
"inputs":[
|
||||
{"indexed":false,"name":"value","type":"uint256"}
|
||||
]
|
||||
},{
|
||||
"name":"SingleTransact",
|
||||
"type":"event",
|
||||
"inputs":[
|
||||
{"indexed":true,"name":"out","type":"string32"},
|
||||
{"indexed":false,"name":"owner","type":"address"},
|
||||
{"indexed":false,"name":"value","type":"uint256"},
|
||||
{"indexed":false,"name":"to","type":"address"}
|
||||
]
|
||||
},{
|
||||
"name":"MultiTransact",
|
||||
"type":"event",
|
||||
"inputs":[
|
||||
{"indexed":true,"name":"out","type":"string32"},
|
||||
{"indexed":false,"name":"owner","type":"address"},
|
||||
{"indexed":false,"name":"operation","type":"hash256"},
|
||||
{"indexed":false,"name":"value","type":"uint256"},
|
||||
{"indexed":false,"name":"to","type":"address"}
|
||||
]
|
||||
}
|
||||
];
|
|
@ -1,84 +0,0 @@
|
|||
|
||||
<!doctype>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="badge" content="10">
|
||||
<script type="text/javascript" src="../ext/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../ext/ethereum.js/dist/ethereum.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Info</h1>
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>Block number</td>
|
||||
<td id="number"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Peer count</td>
|
||||
<td id="peer_count"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Default block</td>
|
||||
<td id="default_block"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Accounts</td>
|
||||
<td id="accounts"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Balance</td>
|
||||
<td id="balance"></td>
|
||||
|
||||
<tr>
|
||||
<td>Gas price</td>
|
||||
<td id="gas_price"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Mining</td>
|
||||
<td id="mining"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Listening</td>
|
||||
<td id="listening"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Coinbase</td>
|
||||
<td id="coinbase"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
var web3 = require('web3');
|
||||
var eth = web3.eth;
|
||||
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8545'));
|
||||
|
||||
eth.defaultBlock = -2
|
||||
|
||||
document.querySelector("#number").innerHTML = eth.number;
|
||||
document.querySelector("#coinbase").innerHTML = eth.coinbase
|
||||
document.querySelector("#peer_count").innerHTML = eth.peerCount;
|
||||
document.querySelector("#default_block").innerHTML = eth.defaultBlock;
|
||||
document.querySelector("#accounts").innerHTML = eth.accounts;
|
||||
document.querySelector("#balance").innerHTML = web3.toEth(eth.balanceAt(eth.accounts[0]));
|
||||
document.querySelector("#gas_price").innerHTML = eth.gasPrice;
|
||||
document.querySelector("#mining").innerHTML = eth.mining;
|
||||
document.querySelector("#listening").innerHTML = eth.listening;
|
||||
eth.watch('chain').changed(function() {
|
||||
document.querySelector("#number").innerHTML = eth.number;
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</html>
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
<!doctype>
|
||||
<html>
|
||||
<title>Whisper test</title>
|
||||
<head>
|
||||
<script type="text/javascript" src="../ext/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../ext/ethereum.js/dist/ethereum.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Whisper test</h1>
|
||||
|
||||
<button onclick="test()">Send</button>
|
||||
<button onclick="test2()">Private send</button>
|
||||
|
||||
<table width="100%" id="table">
|
||||
<tr>
|
||||
<td>Count</td>
|
||||
<td id="count"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>ID</td>
|
||||
<td id="id"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Has identity</td>
|
||||
<td id="known"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
var web3 = require('web3');
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
|
||||
|
||||
var shh = web3.shh;
|
||||
|
||||
var id = shh.newIdentity();
|
||||
document.querySelector("#id").innerHTML = id;
|
||||
document.querySelector("#known").innerHTML = shh.haveIdentity(id);
|
||||
|
||||
var watch = shh.watch({topics: ["test"]})
|
||||
watch.arrived(function(message) {
|
||||
document.querySelector("#table").innerHTML += "<tr><td colspan='2'>"+JSON.stringify(message)+"</td></tr>";
|
||||
});
|
||||
|
||||
var selfWatch = shh.watch({to: id, topics: ["test"]})
|
||||
selfWatch.arrived(function(message) {
|
||||
document.querySelector("#table").innerHTML += "<tr><td>To me</td><td>"+JSON.stringify(message)+"</td></tr>";
|
||||
});
|
||||
|
||||
function test() {
|
||||
shh.post({topics: ["test"], payload: web3.fromAscii("test it")});
|
||||
count();
|
||||
}
|
||||
|
||||
function test2() {
|
||||
shh.post({to: id, topics: ["test"], payload: web3.fromAscii("Private")});
|
||||
count();
|
||||
}
|
||||
|
||||
function count() {
|
||||
document.querySelector("#count").innerHTML = watch.messages().length;
|
||||
}
|
||||
</script>
|
||||
|
||||
</html>
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"directory": "example/js/",
|
||||
"cwd": "./",
|
||||
"analytics": false
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
|
@ -1,18 +0,0 @@
|
|||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
#
|
||||
# If you find yourself ignoring temporary files generated by your text editor
|
||||
# or operating system, you probably want to add a global ignore instead:
|
||||
# git config --global core.excludesfile ~/.gitignore_global
|
||||
|
||||
*.swp
|
||||
/tmp
|
||||
*/**/*un~
|
||||
*un~
|
||||
.DS_Store
|
||||
*/**/.DS_Store
|
||||
ethereum/ethereum
|
||||
ethereal/ethereal
|
||||
example/js
|
||||
node_modules
|
||||
bower_components
|
||||
npm-debug.log
|
|
@ -1,50 +0,0 @@
|
|||
{
|
||||
"predef": [
|
||||
"console",
|
||||
"require",
|
||||
"equal",
|
||||
"test",
|
||||
"testBoth",
|
||||
"testWithDefault",
|
||||
"raises",
|
||||
"deepEqual",
|
||||
"start",
|
||||
"stop",
|
||||
"ok",
|
||||
"strictEqual",
|
||||
"module",
|
||||
"expect",
|
||||
"reject",
|
||||
"impl"
|
||||
],
|
||||
|
||||
"esnext": true,
|
||||
"proto": true,
|
||||
"node" : true,
|
||||
"browser" : true,
|
||||
"browserify" : true,
|
||||
|
||||
"boss" : true,
|
||||
"curly": false,
|
||||
"debug": true,
|
||||
"devel": true,
|
||||
"eqeqeq": true,
|
||||
"evil": true,
|
||||
"forin": false,
|
||||
"immed": false,
|
||||
"laxbreak": false,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": false,
|
||||
"nonew": false,
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"plusplus": false,
|
||||
"regexp": false,
|
||||
"undef": true,
|
||||
"sub": true,
|
||||
"strict": false,
|
||||
"white": false,
|
||||
"shadow": true,
|
||||
"eqnull": true
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
example/js
|
||||
node_modules
|
||||
test
|
||||
.gitignore
|
||||
.editorconfig
|
||||
.travis.yml
|
||||
.npmignore
|
||||
component.json
|
||||
testling.html
|
|
@ -1,13 +0,0 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "0.11"
|
||||
- "0.10"
|
||||
before_script:
|
||||
- npm install
|
||||
- npm install jshint
|
||||
script:
|
||||
- "jshint *.js lib"
|
||||
after_script:
|
||||
- npm run-script build
|
||||
- npm test
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 08f3aaea8cad2cf07276d6709e2ee384afe90d3c
|
|
@ -1,66 +0,0 @@
|
|||
// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301 USA
|
||||
|
||||
var ethx = {
|
||||
prototype: Object,
|
||||
|
||||
watch: function(options) {
|
||||
return new Filter(options);
|
||||
},
|
||||
|
||||
note: function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
var o = []
|
||||
for(var i = 0; i < args.length; i++) {
|
||||
o.push(args[i].toString())
|
||||
}
|
||||
|
||||
eth.notef(o);
|
||||
},
|
||||
};
|
||||
|
||||
var Filter = function(options) {
|
||||
this.callbacks = [];
|
||||
this.options = options;
|
||||
|
||||
if(options === "chain") {
|
||||
this.id = eth.newFilterString(options);
|
||||
} else if(typeof options === "object") {
|
||||
this.id = eth.newFilter(options);
|
||||
}
|
||||
};
|
||||
|
||||
Filter.prototype.changed = function(callback) {
|
||||
this.callbacks.push(callback);
|
||||
|
||||
var self = this;
|
||||
messages.connect(function(messages, id) {
|
||||
if(id == self.id) {
|
||||
for(var i = 0; i < self.callbacks.length; i++) {
|
||||
self.callbacks[i].call(self, messages);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Filter.prototype.uninstall = function() {
|
||||
eth.uninstallFilter(this.id)
|
||||
}
|
||||
|
||||
Filter.prototype.messages = function() {
|
||||
return eth.messages(this.id)
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301 USA
|
||||
|
||||
// this function is included locally, but you can also include separately via a header definition
|
||||
function request(url, callback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = (function(req) {
|
||||
return function() {
|
||||
if(req.readyState === 4) {
|
||||
callback(req);
|
||||
}
|
||||
}
|
||||
})(xhr);
|
||||
xhr.open('GET', url, true);
|
||||
xhr.send('');
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
// Copyright (c) 2015, ETHDEV. All rights reserved.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301 USA
|
||||
|
||||
// this function is included locally, but you can also include separately via a header definition
|
||||
|
||||
|
||||
document.onkeydown = function(evt) {
|
||||
// This functions keeps track of keyboard inputs in order to allow copy, paste and other features
|
||||
|
||||
evt = evt || window.event;
|
||||
if (evt.ctrlKey && evt.keyCode == 67) {
|
||||
window.document.execCommand("copy");
|
||||
} else if (evt.ctrlKey && evt.keyCode == 88) {
|
||||
window.document.execCommand("cut");
|
||||
} else if (evt.ctrlKey && evt.keyCode == 86) {
|
||||
window.document.execCommand("paste");
|
||||
} else if (evt.ctrlKey && evt.keyCode == 90) {
|
||||
window.document.execCommand("undo");
|
||||
} else if (evt.ctrlKey && evt.shiftKey && evt.keyCode == 90) {
|
||||
window.document.execCommand("redo");
|
||||
}
|
||||
};
|
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 4.2 KiB |
|
@ -1,83 +0,0 @@
|
|||
<!doctype>
|
||||
<html>
|
||||
<head>
|
||||
<title>Ethereum</title>
|
||||
<script type="text/javascript" src="../ext/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../ext/ethereum.js/dist/ethereum.js"></script>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: Helvetica;
|
||||
}
|
||||
div.logo {
|
||||
width: 192px;
|
||||
margin: 40px auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="logo"><img src="logo.png"></img></div>
|
||||
<h1>Info</h1>
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>Block number</td>
|
||||
<td id="number"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Peer count</td>
|
||||
<td id="peer_count"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Accounts</td>
|
||||
<td id="accounts"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Gas price</td>
|
||||
<td id="gas_price"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Mining</td>
|
||||
<td id="mining"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Listening</td>
|
||||
<td id="listening"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Coinbase</td>
|
||||
<td id="coinbase"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
var web3 = require('web3');
|
||||
var eth = web3.eth;
|
||||
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8545'));
|
||||
|
||||
document.querySelector("#number").innerHTML = eth.number;
|
||||
document.querySelector("#coinbase").innerHTML = eth.coinbase
|
||||
document.querySelector("#peer_count").innerHTML = eth.peerCount;
|
||||
document.querySelector("#accounts").innerHTML = eth.accounts;
|
||||
document.querySelector("#gas_price").innerHTML = eth.gasPrice;
|
||||
document.querySelector("#mining").innerHTML = eth.mining;
|
||||
document.querySelector("#listening").innerHTML = eth.listening;
|
||||
|
||||
eth.watch('pending').changed(function() {
|
||||
console.log("pending changed");
|
||||
});
|
||||
eth.watch('chain').changed(function() {
|
||||
document.querySelector("#number").innerHTML = eth.number;
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 2.3 KiB |
|
@ -1,272 +0,0 @@
|
|||
/* BASICS */
|
||||
|
||||
.CodeMirror {
|
||||
/* Set height, width, borders, and global font properties here */
|
||||
font-family: monospace;
|
||||
height: 300px;
|
||||
}
|
||||
.CodeMirror-scroll {
|
||||
/* Set scrolling behaviour here */
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* PADDING */
|
||||
|
||||
.CodeMirror-lines {
|
||||
padding: 4px 0; /* Vertical padding around content */
|
||||
}
|
||||
.CodeMirror pre {
|
||||
padding: 0 4px; /* Horizontal padding of content */
|
||||
}
|
||||
|
||||
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||
background-color: white; /* The little square between H and V scrollbars */
|
||||
}
|
||||
|
||||
/* GUTTER */
|
||||
|
||||
.CodeMirror-gutters {
|
||||
border-right: 1px solid #ddd;
|
||||
background-color: #f7f7f7;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.CodeMirror-linenumbers {}
|
||||
.CodeMirror-linenumber {
|
||||
padding: 0 3px 0 5px;
|
||||
min-width: 20px;
|
||||
text-align: right;
|
||||
color: #999;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
/* CURSOR */
|
||||
|
||||
.CodeMirror div.CodeMirror-cursor {
|
||||
border-left: 1px solid black;
|
||||
}
|
||||
/* Shown when moving in bi-directional text */
|
||||
.CodeMirror div.CodeMirror-secondarycursor {
|
||||
border-left: 1px solid silver;
|
||||
}
|
||||
.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
|
||||
width: auto;
|
||||
border: 0;
|
||||
background: #7e7;
|
||||
}
|
||||
/* Can style cursor different in overwrite (non-insert) mode */
|
||||
div.CodeMirror-overwrite div.CodeMirror-cursor {}
|
||||
|
||||
.cm-tab { display: inline-block; }
|
||||
|
||||
.CodeMirror-ruler {
|
||||
border-left: 1px solid #ccc;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/* DEFAULT THEME */
|
||||
|
||||
.cm-s-default .cm-keyword {color: #708;}
|
||||
.cm-s-default .cm-atom {color: #219;}
|
||||
.cm-s-default .cm-number {color: #164;}
|
||||
.cm-s-default .cm-def {color: #00f;}
|
||||
.cm-s-default .cm-variable,
|
||||
.cm-s-default .cm-punctuation,
|
||||
.cm-s-default .cm-property,
|
||||
.cm-s-default .cm-operator {}
|
||||
.cm-s-default .cm-variable-2 {color: #05a;}
|
||||
.cm-s-default .cm-variable-3 {color: #085;}
|
||||
.cm-s-default .cm-comment {color: #a50;}
|
||||
.cm-s-default .cm-string {color: #a11;}
|
||||
.cm-s-default .cm-string-2 {color: #f50;}
|
||||
.cm-s-default .cm-meta {color: #555;}
|
||||
.cm-s-default .cm-qualifier {color: #555;}
|
||||
.cm-s-default .cm-builtin {color: #30a;}
|
||||
.cm-s-default .cm-bracket {color: #997;}
|
||||
.cm-s-default .cm-tag {color: #170;}
|
||||
.cm-s-default .cm-attribute {color: #00c;}
|
||||
.cm-s-default .cm-header {color: blue;}
|
||||
.cm-s-default .cm-quote {color: #090;}
|
||||
.cm-s-default .cm-hr {color: #999;}
|
||||
.cm-s-default .cm-link {color: #00c;}
|
||||
|
||||
.cm-negative {color: #d44;}
|
||||
.cm-positive {color: #292;}
|
||||
.cm-header, .cm-strong {font-weight: bold;}
|
||||
.cm-em {font-style: italic;}
|
||||
.cm-link {text-decoration: underline;}
|
||||
|
||||
.cm-s-default .cm-error {color: #f00;}
|
||||
.cm-invalidchar {color: #f00;}
|
||||
|
||||
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
||||
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||
.CodeMirror-activeline-background {background: #e8f2ff;}
|
||||
|
||||
/* STOP */
|
||||
|
||||
/* The rest of this file contains styles related to the mechanics of
|
||||
the editor. You probably shouldn't touch them. */
|
||||
|
||||
.CodeMirror {
|
||||
line-height: 1;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.CodeMirror-scroll {
|
||||
/* 30px is the magic margin used to hide the element's real scrollbars */
|
||||
/* See overflow: hidden in .CodeMirror */
|
||||
margin-bottom: -30px; margin-right: -30px;
|
||||
padding-bottom: 30px;
|
||||
height: 100%;
|
||||
outline: none; /* Prevent dragging from highlighting the element */
|
||||
position: relative;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
.CodeMirror-sizer {
|
||||
position: relative;
|
||||
border-right: 30px solid transparent;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
||||
before actuall scrolling happens, thus preventing shaking and
|
||||
flickering artifacts. */
|
||||
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||
position: absolute;
|
||||
z-index: 6;
|
||||
display: none;
|
||||
}
|
||||
.CodeMirror-vscrollbar {
|
||||
right: 0; top: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.CodeMirror-hscrollbar {
|
||||
bottom: 0; left: 0;
|
||||
overflow-y: hidden;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
.CodeMirror-scrollbar-filler {
|
||||
right: 0; bottom: 0;
|
||||
}
|
||||
.CodeMirror-gutter-filler {
|
||||
left: 0; bottom: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-gutters {
|
||||
position: absolute; left: 0; top: 0;
|
||||
padding-bottom: 30px;
|
||||
z-index: 3;
|
||||
}
|
||||
.CodeMirror-gutter {
|
||||
white-space: normal;
|
||||
height: 100%;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
padding-bottom: 30px;
|
||||
margin-bottom: -32px;
|
||||
display: inline-block;
|
||||
/* Hack to make IE7 behave */
|
||||
*zoom:1;
|
||||
*display:inline;
|
||||
}
|
||||
.CodeMirror-gutter-elt {
|
||||
position: absolute;
|
||||
cursor: default;
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
.CodeMirror-lines {
|
||||
cursor: text;
|
||||
}
|
||||
.CodeMirror pre {
|
||||
/* Reset some styles that the rest of the page might have set */
|
||||
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
||||
border-width: 0;
|
||||
background: transparent;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
margin: 0;
|
||||
white-space: pre;
|
||||
word-wrap: normal;
|
||||
line-height: inherit;
|
||||
color: inherit;
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
}
|
||||
.CodeMirror-wrap pre {
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
.CodeMirror-linebackground {
|
||||
position: absolute;
|
||||
left: 0; right: 0; top: 0; bottom: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-linewidget {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.CodeMirror-widget {}
|
||||
|
||||
.CodeMirror-wrap .CodeMirror-scroll {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.CodeMirror-measure {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
}
|
||||
.CodeMirror-measure pre { position: static; }
|
||||
|
||||
.CodeMirror div.CodeMirror-cursor {
|
||||
position: absolute;
|
||||
border-right: none;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
div.CodeMirror-cursors {
|
||||
visibility: hidden;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
.CodeMirror-focused div.CodeMirror-cursors {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.CodeMirror-selected { background: #d9d9d9; }
|
||||
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
|
||||
.CodeMirror-crosshair { cursor: crosshair; }
|
||||
|
||||
.cm-searching {
|
||||
background: #ffa;
|
||||
background: rgba(255, 255, 0, .4);
|
||||
}
|
||||
|
||||
/* IE7 hack to prevent it from returning funny offsetTops on the spans */
|
||||
.CodeMirror span { *vertical-align: text-bottom; }
|
||||
|
||||
/* Used to force a border model for a node */
|
||||
.cm-force-border { padding-right: .1px; }
|
||||
|
||||
@media print {
|
||||
/* Hide the cursor when printing */
|
||||
.CodeMirror div.CodeMirror-cursors {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
<!doctype>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
margin: 0; padding: 0;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
#debugger {
|
||||
height: 100%;
|
||||
font-family: "Monaco"
|
||||
}
|
||||
#debugger .line {
|
||||
overflow: none;
|
||||
}
|
||||
#debugger .col1, #debugger .col2 {
|
||||
float: left;
|
||||
padding: 3px;
|
||||
}
|
||||
#debugger .col1 {
|
||||
width: 10px;
|
||||
padding-left: 10px
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
#debugger .col2 {
|
||||
width: 90%;
|
||||
}
|
||||
.prompt {
|
||||
color: "#5089D4";
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="debugger">
|
||||
<div class="line">
|
||||
<div class="col1 prompt">
|
||||
>
|
||||
</div>
|
||||
<div class="col2" contenteditable>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,23 +0,0 @@
|
|||
.cm-s-eclipse span.cm-meta {color: #FF1717;}
|
||||
.cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; }
|
||||
.cm-s-eclipse span.cm-atom {color: #219;}
|
||||
.cm-s-eclipse span.cm-number {color: #164;}
|
||||
.cm-s-eclipse span.cm-def {color: #00f;}
|
||||
.cm-s-eclipse span.cm-variable {color: black;}
|
||||
.cm-s-eclipse span.cm-variable-2 {color: #0000C0;}
|
||||
.cm-s-eclipse span.cm-variable-3 {color: #0000C0;}
|
||||
.cm-s-eclipse span.cm-property {color: black;}
|
||||
.cm-s-eclipse span.cm-operator {color: black;}
|
||||
.cm-s-eclipse span.cm-comment {color: #3F7F5F;}
|
||||
.cm-s-eclipse span.cm-string {color: #2A00FF;}
|
||||
.cm-s-eclipse span.cm-string-2 {color: #f50;}
|
||||
.cm-s-eclipse span.cm-qualifier {color: #555;}
|
||||
.cm-s-eclipse span.cm-builtin {color: #30a;}
|
||||
.cm-s-eclipse span.cm-bracket {color: #cc7;}
|
||||
.cm-s-eclipse span.cm-tag {color: #170;}
|
||||
.cm-s-eclipse span.cm-attribute {color: #00c;}
|
||||
.cm-s-eclipse span.cm-link {color: #219;}
|
||||
.cm-s-eclipse span.cm-error {color: #f00;}
|
||||
|
||||
.cm-s-eclipse .CodeMirror-activeline-background {background: #e8f2ff !important;}
|
||||
.cm-s-eclipse .CodeMirror-matchingbracket {outline:1px solid grey; color:black !important;}
|
|
@ -1,80 +0,0 @@
|
|||
<!doctype>
|
||||
<html>
|
||||
<head>
|
||||
<title>Mutan Editor</title>
|
||||
<link rel="stylesheet" href="codemirror.css">
|
||||
<link rel="stylesheet" href="eclipse.css">
|
||||
<script src="lib/codemirror.js"></script>
|
||||
<script src="lib/matchbrackets.js"></script>
|
||||
<script src="lib/go.js"></script>
|
||||
<script src="muted.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
margin: 0; padding: 0;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
#debugger {
|
||||
height: 30%;
|
||||
font-family: "Monaco";
|
||||
border-top: 5px solid grey;
|
||||
}
|
||||
#debugger .line {
|
||||
overflow: none;
|
||||
}
|
||||
#debugger .col1, #debugger .col2 {
|
||||
float: left;
|
||||
padding: 3px;
|
||||
}
|
||||
#debugger .col1 {
|
||||
width: 10px;
|
||||
padding-left: 10px
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
#debugger .col2 {
|
||||
width: 90%;
|
||||
}
|
||||
.prompt {
|
||||
color: "#5089D4";
|
||||
}
|
||||
|
||||
.CodeMirror {
|
||||
height: 70%;
|
||||
font-size: 14pt;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<textarea id="editor"></textarea>
|
||||
|
||||
<div id="debugger">
|
||||
<div class="line">
|
||||
<div class="col1 prompt">
|
||||
>
|
||||
</div>
|
||||
<div class="col2" contenteditable>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var textArea = document.querySelector("#editor")
|
||||
var editor = CodeMirror.fromTextArea(textArea, {
|
||||
theme: "eclipse",
|
||||
mode: "text/html",
|
||||
lineNumbers: true,
|
||||
mode: "text/x-go",
|
||||
indentUnit: 8,
|
||||
tabSize: 8,
|
||||
indentWithTabs: true,
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,182 +0,0 @@
|
|||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("go", function(config) {
|
||||
var indentUnit = config.indentUnit;
|
||||
|
||||
var keywords = {
|
||||
"break":true, "case":true, "chan":true, "const":true, "continue":true,
|
||||
"default":true, "defer":true, "else":true, "fallthrough":true, "for":true,
|
||||
"func":true, "go":true, "goto":true, "if":true, "import":true,
|
||||
"interface":true, "map":true, "package":true, "range":true, "return":true,
|
||||
"select":true, "struct":true, "switch":true, "type":true, "var":true,
|
||||
"bool":true, "byte":true, "complex64":true, "complex128":true,
|
||||
"float32":true, "float64":true, "int8":true, "int16":true, "int32":true,
|
||||
"int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true,
|
||||
"uint64":true, "int":true, "uint":true, "uintptr":true, "big": true,
|
||||
"main": true, "init": true, "this":true
|
||||
};
|
||||
|
||||
var atoms = {
|
||||
"true":true, "false":true, "iota":true, "nil":true, "append":true,
|
||||
"cap":true, "close":true, "complex":true, "copy":true, "imag":true,
|
||||
"len":true, "make":true, "new":true, "panic":true, "print":true,
|
||||
"println":true, "real":true, "recover":true,
|
||||
};
|
||||
|
||||
var isOperatorChar = /[+\-*&^%:=<>!|\/]/;
|
||||
|
||||
var curPunc;
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
var ch = stream.next();
|
||||
if (ch == '"' || ch == "'" || ch == "`") {
|
||||
state.tokenize = tokenString(ch);
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
if (/[\d\.]/.test(ch)) {
|
||||
if (ch == ".") {
|
||||
stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
|
||||
} else if (ch == "0") {
|
||||
stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
|
||||
} else {
|
||||
stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
|
||||
}
|
||||
return "number";
|
||||
}
|
||||
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
||||
curPunc = ch;
|
||||
return null;
|
||||
}
|
||||
if (ch == "/") {
|
||||
if (stream.eat("*")) {
|
||||
state.tokenize = tokenComment;
|
||||
return tokenComment(stream, state);
|
||||
}
|
||||
if (stream.eat("/")) {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
}
|
||||
if (isOperatorChar.test(ch)) {
|
||||
stream.eatWhile(isOperatorChar);
|
||||
return "operator";
|
||||
}
|
||||
stream.eatWhile(/[\w\$_]/);
|
||||
var cur = stream.current();
|
||||
if (keywords.propertyIsEnumerable(cur)) {
|
||||
if (cur == "case" || cur == "default") curPunc = "case";
|
||||
return "keyword";
|
||||
}
|
||||
if (atoms.propertyIsEnumerable(cur)) return "atom";
|
||||
return "variable";
|
||||
}
|
||||
|
||||
function tokenString(quote) {
|
||||
return function(stream, state) {
|
||||
var escaped = false, next, end = false;
|
||||
while ((next = stream.next()) != null) {
|
||||
if (next == quote && !escaped) {end = true; break;}
|
||||
escaped = !escaped && next == "\\";
|
||||
}
|
||||
if (end || !(escaped || quote == "`"))
|
||||
state.tokenize = tokenBase;
|
||||
return "string";
|
||||
};
|
||||
}
|
||||
|
||||
function tokenComment(stream, state) {
|
||||
var maybeEnd = false, ch;
|
||||
while (ch = stream.next()) {
|
||||
if (ch == "/" && maybeEnd) {
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
maybeEnd = (ch == "*");
|
||||
}
|
||||
return "comment";
|
||||
}
|
||||
|
||||
function Context(indented, column, type, align, prev) {
|
||||
this.indented = indented;
|
||||
this.column = column;
|
||||
this.type = type;
|
||||
this.align = align;
|
||||
this.prev = prev;
|
||||
}
|
||||
function pushContext(state, col, type) {
|
||||
return state.context = new Context(state.indented, col, type, null, state.context);
|
||||
}
|
||||
function popContext(state) {
|
||||
var t = state.context.type;
|
||||
if (t == ")" || t == "]" || t == "}")
|
||||
state.indented = state.context.indented;
|
||||
return state.context = state.context.prev;
|
||||
}
|
||||
|
||||
// Interface
|
||||
|
||||
return {
|
||||
startState: function(basecolumn) {
|
||||
return {
|
||||
tokenize: null,
|
||||
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
||||
indented: 0,
|
||||
startOfLine: true
|
||||
};
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
var ctx = state.context;
|
||||
if (stream.sol()) {
|
||||
if (ctx.align == null) ctx.align = false;
|
||||
state.indented = stream.indentation();
|
||||
state.startOfLine = true;
|
||||
if (ctx.type == "case") ctx.type = "}";
|
||||
}
|
||||
if (stream.eatSpace()) return null;
|
||||
curPunc = null;
|
||||
var style = (state.tokenize || tokenBase)(stream, state);
|
||||
if (style == "comment") return style;
|
||||
if (ctx.align == null) ctx.align = true;
|
||||
|
||||
if (curPunc == "{") pushContext(state, stream.column(), "}");
|
||||
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
||||
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
||||
else if (curPunc == "case") ctx.type = "case";
|
||||
else if (curPunc == "}" && ctx.type == "}") ctx = popContext(state);
|
||||
else if (curPunc == ctx.type) popContext(state);
|
||||
state.startOfLine = false;
|
||||
return style;
|
||||
},
|
||||
|
||||
indent: function(state, textAfter) {
|
||||
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
|
||||
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
|
||||
if (ctx.type == "case" && /^(?:case|default)\b/.test(textAfter)) {
|
||||
state.context.type = "}";
|
||||
return ctx.indented;
|
||||
}
|
||||
var closing = firstChar == ctx.type;
|
||||
if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
||||
else return ctx.indented + (closing ? 0 : indentUnit);
|
||||
},
|
||||
|
||||
electricChars: "{}):",
|
||||
fold: "brace",
|
||||
blockCommentStart: "/*",
|
||||
blockCommentEnd: "*/",
|
||||
lineComment: "//"
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-go", "go");
|
||||
|
||||
});
|
|
@ -1,117 +0,0 @@
|
|||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
|
||||
(document.documentMode == null || document.documentMode < 8);
|
||||
|
||||
var Pos = CodeMirror.Pos;
|
||||
|
||||
var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
|
||||
|
||||
function findMatchingBracket(cm, where, strict, config) {
|
||||
var line = cm.getLineHandle(where.line), pos = where.ch - 1;
|
||||
var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
|
||||
if (!match) return null;
|
||||
var dir = match.charAt(1) == ">" ? 1 : -1;
|
||||
if (strict && (dir > 0) != (pos == where.ch)) return null;
|
||||
var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));
|
||||
|
||||
var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config);
|
||||
if (found == null) return null;
|
||||
return {from: Pos(where.line, pos), to: found && found.pos,
|
||||
match: found && found.ch == match.charAt(0), forward: dir > 0};
|
||||
}
|
||||
|
||||
// bracketRegex is used to specify which type of bracket to scan
|
||||
// should be a regexp, e.g. /[[\]]/
|
||||
//
|
||||
// Note: If "where" is on an open bracket, then this bracket is ignored.
|
||||
//
|
||||
// Returns false when no bracket was found, null when it reached
|
||||
// maxScanLines and gave up
|
||||
function scanForBracket(cm, where, dir, style, config) {
|
||||
var maxScanLen = (config && config.maxScanLineLength) || 10000;
|
||||
var maxScanLines = (config && config.maxScanLines) || 1000;
|
||||
|
||||
var stack = [];
|
||||
var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/;
|
||||
var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
|
||||
: Math.max(cm.firstLine() - 1, where.line - maxScanLines);
|
||||
for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
|
||||
var line = cm.getLine(lineNo);
|
||||
if (!line) continue;
|
||||
var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;
|
||||
if (line.length > maxScanLen) continue;
|
||||
if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);
|
||||
for (; pos != end; pos += dir) {
|
||||
var ch = line.charAt(pos);
|
||||
if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
|
||||
var match = matching[ch];
|
||||
if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
|
||||
else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
|
||||
else stack.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;
|
||||
}
|
||||
|
||||
function matchBrackets(cm, autoclear, config) {
|
||||
// Disable brace matching in long lines, since it'll cause hugely slow updates
|
||||
var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;
|
||||
var marks = [], ranges = cm.listSelections();
|
||||
for (var i = 0; i < ranges.length; i++) {
|
||||
var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, false, config);
|
||||
if (match && cm.getLine(match.from.line).length <= maxHighlightLen) {
|
||||
var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
|
||||
marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style}));
|
||||
if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen)
|
||||
marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style}));
|
||||
}
|
||||
}
|
||||
|
||||
if (marks.length) {
|
||||
// Kludge to work around the IE bug from issue #1193, where text
|
||||
// input stops going to the textare whever this fires.
|
||||
if (ie_lt8 && cm.state.focused) cm.display.input.focus();
|
||||
|
||||
var clear = function() {
|
||||
cm.operation(function() {
|
||||
for (var i = 0; i < marks.length; i++) marks[i].clear();
|
||||
});
|
||||
};
|
||||
if (autoclear) setTimeout(clear, 800);
|
||||
else return clear;
|
||||
}
|
||||
}
|
||||
|
||||
var currentlyHighlighted = null;
|
||||
function doMatchBrackets(cm) {
|
||||
cm.operation(function() {
|
||||
if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;}
|
||||
currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets);
|
||||
});
|
||||
}
|
||||
|
||||
CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
|
||||
if (old && old != CodeMirror.Init)
|
||||
cm.off("cursorActivity", doMatchBrackets);
|
||||
if (val) {
|
||||
cm.state.matchBrackets = typeof val == "object" ? val : {};
|
||||
cm.on("cursorActivity", doMatchBrackets);
|
||||
}
|
||||
});
|
||||
|
||||
CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
|
||||
CodeMirror.defineExtension("findMatchingBracket", function(pos, strict, config){
|
||||
return findMatchingBracket(this, pos, strict, config);
|
||||
});
|
||||
CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){
|
||||
return scanForBracket(this, pos, dir, style, config);
|
||||
});
|
||||
});
|
|
@ -1,78 +0,0 @@
|
|||
// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301 USA
|
||||
|
||||
// Helper function for generating pseudo callbacks and sending data to the QML part of the application
|
||||
function postData(data, cb) {
|
||||
data._seed = Math.floor(Math.random() * 1000000)
|
||||
if(cb) {
|
||||
Muted._callbacks[data._seed] = cb;
|
||||
}
|
||||
|
||||
if(data.args === undefined) {
|
||||
data.args = [];
|
||||
}
|
||||
|
||||
navigator.qt.postMessage(JSON.stringify(data));
|
||||
}
|
||||
|
||||
window.Muted = {
|
||||
prototype: Object(),
|
||||
}
|
||||
|
||||
window.Muted._callbacks = {}
|
||||
window.Muted._onCallbacks = {}
|
||||
|
||||
function debug(/**/) {
|
||||
console.log("hello world")
|
||||
|
||||
var args = arguments;
|
||||
var msg = ""
|
||||
for(var i = 0; i < args.length; i++){
|
||||
if(typeof args[i] == "object") {
|
||||
msg += " " + JSON.stringify(args[i])
|
||||
} else {
|
||||
msg += args[i]
|
||||
}
|
||||
}
|
||||
|
||||
document.querySelector("#debugger").innerHTML += "<div class='line'><div class='col1'></div><div class='col2'>"+msg+"</div></div>";
|
||||
}
|
||||
console.log = function() {
|
||||
var args = []
|
||||
for(var i = 0; i < arguments.length; i++) {
|
||||
args.push(arguments[i]);
|
||||
}
|
||||
postData({call:"log", args:args})
|
||||
}
|
||||
|
||||
navigator.qt.onmessage = function(ev) {
|
||||
var data = JSON.parse(ev.data)
|
||||
|
||||
if(data._event !== undefined) {
|
||||
Muted.trigger(data._event, data.data);
|
||||
} else {
|
||||
if(data._seed) {
|
||||
var cb = Muted._callbacks[data._seed];
|
||||
if(cb) {
|
||||
// Call the callback
|
||||
cb(data.data);
|
||||
// Remove the "trigger" callback
|
||||
delete Muted._callbacks[ev._seed];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 932 B |
|
@ -1,22 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Layouts 1.0;
|
||||
import Ethereum 1.0
|
||||
|
||||
ApplicationWindow {
|
||||
minimumWidth: 500
|
||||
maximumWidth: 500
|
||||
maximumHeight: 400
|
||||
minimumHeight: 400
|
||||
|
||||
function onNewBlockCb(block) {
|
||||
console.log("Please overwrite onNewBlock(block):", block)
|
||||
}
|
||||
function onObjectChangeCb(stateObject) {
|
||||
console.log("Please overwrite onObjectChangeCb(object)", stateObject)
|
||||
}
|
||||
function onStorageChangeCb(storageObject) {
|
||||
var ev = ["storage", storageObject.stateAddress, storageObject.address].join(":");
|
||||
console.log("Please overwrite onStorageChangeCb(object)", ev)
|
||||
}
|
||||
}
|
|
@ -1,486 +0,0 @@
|
|||
import QtQuick 2.1
|
||||
import QtWebKit 3.0
|
||||
import QtWebKit.experimental 1.0
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Controls.Styles 1.0
|
||||
import QtQuick.Layouts 1.0;
|
||||
import QtQuick.Window 2.1;
|
||||
import Ethereum 1.0
|
||||
|
||||
Rectangle {
|
||||
id: window
|
||||
anchors.fill: parent
|
||||
color: "#00000000"
|
||||
|
||||
property var title: "DApps"
|
||||
property var iconSource: "../browser.png"
|
||||
property var menuItem
|
||||
property var hideUrl: true
|
||||
|
||||
property alias url: webview.url
|
||||
property alias windowTitle: webview.title
|
||||
property alias webView: webview
|
||||
|
||||
property var cleanPath: false
|
||||
property var open: function(url) {
|
||||
if(!window.cleanPath) {
|
||||
var uri = url;
|
||||
if(!/.*\:\/\/.*/.test(uri)) {
|
||||
uri = "http://" + uri;
|
||||
}
|
||||
|
||||
var reg = /(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.eth)(.*)/
|
||||
|
||||
if(reg.test(uri)) {
|
||||
uri.replace(reg, function(match, pre, domain, path) {
|
||||
uri = pre;
|
||||
|
||||
var lookup = eth.lookupDomain(domain.substring(0, domain.length - 4));
|
||||
var ip = [];
|
||||
for(var i = 0, l = lookup.length; i < l; i++) {
|
||||
ip.push(lookup.charCodeAt(i))
|
||||
}
|
||||
|
||||
if(ip.length != 0) {
|
||||
uri += lookup;
|
||||
} else {
|
||||
uri += domain;
|
||||
}
|
||||
|
||||
uri += path;
|
||||
});
|
||||
}
|
||||
|
||||
window.cleanPath = true;
|
||||
|
||||
webview.url = uri;
|
||||
|
||||
//uriNav.text = uri.text.replace(/(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.\w{2,3})(.*)/, "$1$2<span style='color:#CCC'>$3</span>");
|
||||
uriNav.text = uri;
|
||||
} else {
|
||||
// Prevent inf loop.
|
||||
window.cleanPath = false;
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
webview.url = "http://etherian.io"
|
||||
}
|
||||
|
||||
function messages(messages, id) {
|
||||
// Bit of a cheat to get proper JSON
|
||||
var m = JSON.parse(JSON.parse(JSON.stringify(messages)))
|
||||
webview.postEvent("eth_changed", id, m);
|
||||
}
|
||||
|
||||
function onShhMessage(message, id) {
|
||||
webview.postEvent("shh_changed", id, message)
|
||||
}
|
||||
|
||||
Item {
|
||||
objectName: "root"
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
state: "inspectorShown"
|
||||
|
||||
RowLayout {
|
||||
id: navBar
|
||||
height: 40
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 7
|
||||
}
|
||||
|
||||
Button {
|
||||
id: back
|
||||
onClicked: {
|
||||
webview.goBack()
|
||||
}
|
||||
style: ButtonStyle {
|
||||
background: Image {
|
||||
source: "../back.png"
|
||||
width: 30
|
||||
height: 30
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
anchors {
|
||||
left: back.right
|
||||
right: toggleInspector.left
|
||||
leftMargin: 10
|
||||
rightMargin: 10
|
||||
}
|
||||
text: webview.url;
|
||||
id: uriNav
|
||||
y: parent.height / 2 - this.height / 2
|
||||
|
||||
Keys.onReturnPressed: {
|
||||
webview.url = this.text;
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: toggleInspector
|
||||
anchors {
|
||||
right: parent.right
|
||||
}
|
||||
iconSource: "../bug.png"
|
||||
onClicked: {
|
||||
if(inspector.visible == true){
|
||||
inspector.visible = false
|
||||
}else{
|
||||
inspector.visible = true
|
||||
inspector.url = webview.experimental.remoteInspectorUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Border
|
||||
Rectangle {
|
||||
id: divider
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: navBar.bottom
|
||||
}
|
||||
z: -1
|
||||
height: 1
|
||||
color: "#CCCCCC"
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
top: divider.bottom
|
||||
}
|
||||
WebView {
|
||||
objectName: "webView"
|
||||
id: webview
|
||||
anchors.fill: parent
|
||||
|
||||
function sendMessage(data) {
|
||||
webview.experimental.postMessage(JSON.stringify(data))
|
||||
}
|
||||
|
||||
experimental.preferences.javascriptEnabled: true
|
||||
experimental.preferences.webAudioEnabled: true
|
||||
experimental.preferences.pluginsEnabled: true
|
||||
experimental.preferences.navigatorQtObjectEnabled: true
|
||||
experimental.preferences.developerExtrasEnabled: true
|
||||
experimental.preferences.webGLEnabled: true
|
||||
experimental.preferences.notificationsEnabled: true
|
||||
experimental.preferences.localStorageEnabled: true
|
||||
experimental.userAgent:"Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Mist/0.1 Safari/537.36"
|
||||
|
||||
experimental.itemSelector: MouseArea {
|
||||
// To avoid conflicting with ListView.model when inside Initiator context.
|
||||
property QtObject selectorModel: model
|
||||
anchors.fill: parent
|
||||
onClicked: selectorModel.reject()
|
||||
|
||||
Menu {
|
||||
visible: true
|
||||
id: itemSelector
|
||||
|
||||
Instantiator {
|
||||
model: selectorModel.items
|
||||
delegate: MenuItem {
|
||||
text: model.text
|
||||
onTriggered: {
|
||||
selectorModel.accept(index)
|
||||
}
|
||||
}
|
||||
onObjectAdded: itemSelector.insertItem(index, object)
|
||||
onObjectRemoved: itemSelector.removeItem(object)
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
itemSelector.popup()
|
||||
}
|
||||
}
|
||||
experimental.userScripts: ["../ext/q.js", "../ext/ethereum.js/dist/ethereum.min.js", "../ext/setup.js"]
|
||||
experimental.onMessageReceived: {
|
||||
//console.log("[onMessageReceived]: ", message.data)
|
||||
var data = JSON.parse(message.data)
|
||||
|
||||
try {
|
||||
switch(data.call) {
|
||||
case "eth_compile":
|
||||
postData(data._id, eth.compile(data.args[0]))
|
||||
break
|
||||
|
||||
case "eth_coinbase":
|
||||
postData(data._id, eth.coinBase())
|
||||
|
||||
case "eth_account":
|
||||
postData(data._id, eth.key().address);
|
||||
|
||||
case "eth_istening":
|
||||
postData(data._id, eth.isListening())
|
||||
|
||||
break
|
||||
|
||||
case "eth_mining":
|
||||
postData(data._id, eth.isMining())
|
||||
|
||||
break
|
||||
|
||||
case "eth_peerCount":
|
||||
postData(data._id, eth.peerCount())
|
||||
|
||||
break
|
||||
|
||||
case "eth_countAt":
|
||||
require(1)
|
||||
postData(data._id, eth.txCountAt(data.args[0]))
|
||||
|
||||
break
|
||||
|
||||
case "eth_codeAt":
|
||||
require(1)
|
||||
var code = eth.codeAt(data.args[0])
|
||||
postData(data._id, code);
|
||||
|
||||
break
|
||||
|
||||
case "eth_blockByNumber":
|
||||
require(1)
|
||||
var block = eth.blockByNumber(data.args[0])
|
||||
postData(data._id, block)
|
||||
break
|
||||
|
||||
case "eth_blockByHash":
|
||||
require(1)
|
||||
var block = eth.blockByHash(data.args[0])
|
||||
postData(data._id, block)
|
||||
break
|
||||
|
||||
require(2)
|
||||
var block = eth.blockByHash(data.args[0])
|
||||
postData(data._id, block.transactions[data.args[1]])
|
||||
break
|
||||
|
||||
case "eth_transactionByHash":
|
||||
case "eth_transactionByNumber":
|
||||
require(2)
|
||||
|
||||
var block;
|
||||
if (data.call === "transactionByHash")
|
||||
block = eth.blockByHash(data.args[0])
|
||||
else
|
||||
block = eth.blockByNumber(data.args[0])
|
||||
|
||||
var tx = block.transactions.get(data.args[1])
|
||||
|
||||
postData(data._id, tx)
|
||||
break
|
||||
|
||||
case "eth_uncleByHash":
|
||||
case "eth_uncleByNumber":
|
||||
require(2)
|
||||
|
||||
var block;
|
||||
if (data.call === "uncleByHash")
|
||||
block = eth.blockByHash(data.args[0])
|
||||
else
|
||||
block = eth.blockByNumber(data.args[0])
|
||||
|
||||
var uncle = block.uncles.get(data.args[1])
|
||||
|
||||
postData(data._id, uncle)
|
||||
|
||||
break
|
||||
|
||||
case "transact":
|
||||
require(5)
|
||||
|
||||
var tx = eth.transact(data.args)
|
||||
postData(data._id, tx)
|
||||
|
||||
break
|
||||
|
||||
case "eth_stateAt":
|
||||
require(2);
|
||||
|
||||
var storage = eth.storageAt(data.args[0], data.args[1]);
|
||||
postData(data._id, storage)
|
||||
|
||||
break
|
||||
|
||||
case "eth_call":
|
||||
require(1);
|
||||
var ret = eth.call(data.args)
|
||||
postData(data._id, ret)
|
||||
break
|
||||
|
||||
case "eth_balanceAt":
|
||||
require(1);
|
||||
|
||||
postData(data._id, eth.balanceAt(data.args[0]));
|
||||
break
|
||||
|
||||
case "eth_watch":
|
||||
require(2)
|
||||
eth.watch(data.args[0], data.args[1])
|
||||
|
||||
case "eth_disconnect":
|
||||
require(1)
|
||||
postData(data._id, null)
|
||||
break;
|
||||
|
||||
case "eth_newFilterString":
|
||||
require(1)
|
||||
var id = eth.newFilterString(data.args[0], window)
|
||||
postData(data._id, id);
|
||||
break;
|
||||
|
||||
case "eth_newFilter":
|
||||
require(1)
|
||||
var id = eth.newFilter(data.args[0], window)
|
||||
|
||||
postData(data._id, id);
|
||||
break;
|
||||
|
||||
case "eth_filterLogs":
|
||||
require(1);
|
||||
|
||||
var messages = eth.messages(data.args[0]);
|
||||
var m = JSON.parse(JSON.parse(JSON.stringify(messages)))
|
||||
postData(data._id, m);
|
||||
|
||||
break;
|
||||
|
||||
case "eth_deleteFilter":
|
||||
require(1);
|
||||
eth.uninstallFilter(data.args[0])
|
||||
break;
|
||||
|
||||
|
||||
case "shh_newFilter":
|
||||
require(1);
|
||||
var id = shh.watch(data.args[0], window);
|
||||
postData(data._id, id);
|
||||
break;
|
||||
|
||||
case "shh_newIdentity":
|
||||
var id = shh.newIdentity()
|
||||
postData(data._id, id)
|
||||
|
||||
break
|
||||
|
||||
case "shh_post":
|
||||
require(1);
|
||||
|
||||
var params = data.args[0];
|
||||
var fields = ["payload", "to", "from"];
|
||||
for(var i = 0; i < fields.length; i++) {
|
||||
params[fields[i]] = params[fields[i]] || "";
|
||||
}
|
||||
if(typeof params.payload !== "object") { params.payload = [params.payload]; } //params.payload = params.payload.join(""); }
|
||||
params.topics = params.topics || [];
|
||||
params.priority = params.priority || 1000;
|
||||
params.ttl = params.ttl || 100;
|
||||
|
||||
shh.post(params.payload, params.to, params.from, params.topics, params.priority, params.ttl);
|
||||
|
||||
break;
|
||||
|
||||
case "shh_getMessages":
|
||||
require(1);
|
||||
|
||||
var m = shh.messages(data.args[0]);
|
||||
var messages = JSON.parse(JSON.parse(JSON.stringify(m)));
|
||||
postData(data._id, messages);
|
||||
|
||||
break;
|
||||
|
||||
case "ssh_newGroup":
|
||||
postData(data._id, "");
|
||||
break;
|
||||
}
|
||||
} catch(e) {
|
||||
console.log(data.call + ": " + e)
|
||||
|
||||
postData(data._id, null);
|
||||
}
|
||||
}
|
||||
|
||||
function post(seed, data) {
|
||||
postData(data._id, data)
|
||||
}
|
||||
function require(args, num) {
|
||||
if(args.length < num) {
|
||||
throw("required argument count of "+num+" got "+args.length);
|
||||
}
|
||||
}
|
||||
function postData(seed, data) {
|
||||
webview.experimental.postMessage(JSON.stringify({data: data, _id: seed}))
|
||||
}
|
||||
function postEvent(event, id, data) {
|
||||
webview.experimental.postMessage(JSON.stringify({data: data, _id: id, _event: event}))
|
||||
}
|
||||
function onWatchedCb(data, id) {
|
||||
var messages = JSON.parse(data)
|
||||
postEvent("watched:"+id, messages)
|
||||
}
|
||||
function onNewBlockCb(block) {
|
||||
postEvent("block:new", block)
|
||||
}
|
||||
function onObjectChangeCb(stateObject) {
|
||||
postEvent("object:"+stateObject.address(), stateObject)
|
||||
}
|
||||
function onStorageChangeCb(storageObject) {
|
||||
var ev = ["storage", storageObject.stateAddress, storageObject.address].join(":");
|
||||
postEvent(ev, [storageObject.address, storageObject.value])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: sizeGrip
|
||||
color: "gray"
|
||||
visible: false
|
||||
height: 10
|
||||
anchors {
|
||||
left: root.left
|
||||
right: root.right
|
||||
}
|
||||
y: Math.round(root.height * 2 / 3)
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
drag.target: sizeGrip
|
||||
drag.minimumY: 0
|
||||
drag.maximumY: root.height
|
||||
drag.axis: Drag.YAxis
|
||||
}
|
||||
}
|
||||
|
||||
WebView {
|
||||
id: inspector
|
||||
visible: false
|
||||
anchors {
|
||||
left: root.left
|
||||
right: root.right
|
||||
top: sizeGrip.bottom
|
||||
bottom: root.bottom
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "inspectorShown"
|
||||
PropertyChanges {
|
||||
target: inspector
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,155 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import Ethereum 1.0
|
||||
|
||||
// Which ones do we actually need?
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Layouts 1.0;
|
||||
import QtQuick.Dialogs 1.0;
|
||||
import QtQuick.Window 2.1;
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Dialogs 1.1
|
||||
|
||||
ApplicationWindow {
|
||||
id: wizardRoot
|
||||
width: 500
|
||||
height: 400
|
||||
title: "Ethereal first run setup"
|
||||
|
||||
Column {
|
||||
spacing: 5
|
||||
anchors.leftMargin: 10
|
||||
anchors.left: parent.left
|
||||
|
||||
Text {
|
||||
visible: true
|
||||
text: "<h2>Ethereal setup</h2>"
|
||||
}
|
||||
|
||||
Column {
|
||||
id: restoreColumn
|
||||
spacing: 5
|
||||
Text {
|
||||
visible: true
|
||||
font.pointSize: 14
|
||||
text: "Restore your Ethereum account"
|
||||
id: restoreLabel
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: txPrivKey
|
||||
width: 480
|
||||
placeholderText: "Private key or mnemonic words"
|
||||
focus: true
|
||||
onTextChanged: {
|
||||
if(this.text.length == 64){
|
||||
detailLabel.text = "Private (hex) key detected."
|
||||
actionButton.enabled = true
|
||||
}
|
||||
else if(this.text.split(" ").length == 24){
|
||||
detailLabel.text = "Mnemonic key detected."
|
||||
actionButton.enabled = true
|
||||
}else{
|
||||
detailLabel.text = ""
|
||||
actionButton.enabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
Row {
|
||||
spacing: 10
|
||||
Button {
|
||||
id: actionButton
|
||||
text: "Restore"
|
||||
enabled: false
|
||||
onClicked: {
|
||||
var success = lib.importAndSetPrivKey(txPrivKey.text)
|
||||
if(success){
|
||||
importedDetails.visible = true
|
||||
restoreColumn.visible = false
|
||||
newKey.visible = false
|
||||
wizardRoot.height = 120
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
id: detailLabel
|
||||
font.pointSize: 12
|
||||
anchors.topMargin: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
Column {
|
||||
id: importedDetails
|
||||
visible: false
|
||||
Text {
|
||||
text: "<b>Your account has been imported. Please close the application and restart it again to let the changes take effect.</b>"
|
||||
wrapMode: Text.WordWrap
|
||||
width: 460
|
||||
}
|
||||
}
|
||||
Column {
|
||||
spacing: 5
|
||||
id: newDetailsColumn
|
||||
visible: false
|
||||
Text {
|
||||
font.pointSize: 14
|
||||
text: "Your account details"
|
||||
}
|
||||
Label {
|
||||
text: "Address"
|
||||
}
|
||||
TextField {
|
||||
id: addressInput
|
||||
readOnly:true
|
||||
width: 480
|
||||
}
|
||||
Label {
|
||||
text: "Private key"
|
||||
}
|
||||
TextField {
|
||||
id: privkeyInput
|
||||
readOnly:true
|
||||
width: 480
|
||||
}
|
||||
Label {
|
||||
text: "Mnemonic words"
|
||||
}
|
||||
TextField {
|
||||
id: mnemonicInput
|
||||
readOnly:true
|
||||
width: 480
|
||||
}
|
||||
Label {
|
||||
text: "<b>A new account has been created. Please take the time to write down the <i>24 words</i>. You can use those to restore your account at a later date.</b>"
|
||||
wrapMode: Text.WordWrap
|
||||
width: 480
|
||||
}
|
||||
Label {
|
||||
text: "Please restart the application once you have completed the steps above."
|
||||
wrapMode: Text.WordWrap
|
||||
width: 480
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Button {
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.rightMargin: 10
|
||||
anchors.bottomMargin: 10
|
||||
id: newKey
|
||||
text: "I don't have an account yet"
|
||||
onClicked: {
|
||||
var res = lib.createAndSetPrivKey()
|
||||
mnemonicInput.text = res[0]
|
||||
addressInput.text = res[1]
|
||||
privkeyInput.text = res[2]
|
||||
|
||||
// Hide restore
|
||||
restoreColumn.visible = false
|
||||
|
||||
// Show new details
|
||||
newDetailsColumn.visible = true
|
||||
newKey.visible = false
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import QtWebKit 3.0
|
||||
import QtWebKit.experimental 1.0
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Layouts 1.0;
|
||||
import QtQuick.Window 2.1;
|
||||
import Ethereum 1.0
|
||||
|
||||
ApplicationWindow {
|
||||
id: window
|
||||
title: "muted"
|
||||
width: 900
|
||||
height: 600
|
||||
minimumHeight: 300
|
||||
|
||||
property alias url: webView.url
|
||||
property alias webView: webView
|
||||
|
||||
|
||||
Item {
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
WebView {
|
||||
objectName: "webView"
|
||||
id: webView
|
||||
anchors {
|
||||
top: root.top
|
||||
right: root.right
|
||||
left: root.left
|
||||
bottom: root.bottom
|
||||
//bottom: sizeGrip.top
|
||||
}
|
||||
|
||||
experimental.preferences.javascriptEnabled: true
|
||||
experimental.preferences.navigatorQtObjectEnabled: true
|
||||
experimental.onMessageReceived: {
|
||||
var data = JSON.parse(message.data)
|
||||
|
||||
switch(data.call) {
|
||||
case "log":
|
||||
console.log.apply(this, data.args)
|
||||
break;
|
||||
}
|
||||
}
|
||||
function postData(seed, data) {
|
||||
webview.experimental.postMessage(JSON.stringify({data: data, _seed: seed}))
|
||||
}
|
||||
function postEvent(event, data) {
|
||||
webview.experimental.postMessage(JSON.stringify({data: data, _event: event}))
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Rectangle {
|
||||
id: sizeGrip
|
||||
color: "gray"
|
||||
height: 5
|
||||
anchors {
|
||||
left: root.left
|
||||
right: root.right
|
||||
}
|
||||
y: Math.round(root.height * 2 / 3)
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
drag.target: sizeGrip
|
||||
drag.minimumY: 0
|
||||
drag.maximumY: root.height - sizeGrip.height
|
||||
drag.axis: Drag.YAxis
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Layouts 1.0;
|
||||
import Ethereum 1.0
|
||||
|
||||
QmlApp {
|
||||
minimumWidth: 350
|
||||
maximumWidth: 350
|
||||
maximumHeight: 80
|
||||
minimumHeight: 80
|
||||
|
||||
title: "Generic Coin"
|
||||
|
||||
property string contractAddr: "f299f6c74515620e4c4cd8fe3d205b5c4f2e25c8"
|
||||
property string addr: "2ef47100e0787b915105fd5e3f4ff6752079d5cb"
|
||||
|
||||
Component.onCompleted: {
|
||||
eth.watch(contractAddr, addr)
|
||||
eth.watch(addr, contractAddr)
|
||||
setAmount()
|
||||
}
|
||||
|
||||
function onStorageChangeCb(storageObject) {
|
||||
setAmount()
|
||||
}
|
||||
|
||||
function setAmount(){
|
||||
var state = eth.getStateObject(contractAddr)
|
||||
var storage = state.getStorage(addr)
|
||||
amountLabel.text = storage
|
||||
}
|
||||
Column {
|
||||
spacing: 5
|
||||
Row {
|
||||
spacing: 20
|
||||
Label {
|
||||
id: genLabel
|
||||
text: "Generic coin balance:"
|
||||
}
|
||||
Label {
|
||||
id: amountLabel
|
||||
}
|
||||
}
|
||||
Row {
|
||||
spacing: 20
|
||||
TextField {
|
||||
id: address
|
||||
placeholderText: "Address"
|
||||
}
|
||||
TextField {
|
||||
id: amount
|
||||
placeholderText: "Amount"
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: "Send coins"
|
||||
onClicked: {
|
||||
var privKey = eth.getKey().privateKey
|
||||
if(privKey){
|
||||
var result = eth.transact(privKey, contractAddr, 0,"100000","250", "0x" + address.text + "\n" + amount.text)
|
||||
resultTx.text = result.hash
|
||||
}
|
||||
}
|
||||
}
|
||||
Label {
|
||||
id: resultTx
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Layouts 1.0;
|
||||
|
||||
Rectangle {
|
||||
id: transactionView
|
||||
visible: false
|
||||
Text { text: "TX VIEW" }
|
||||
}
|
|
@ -1,506 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Controls.Styles 1.0
|
||||
import QtQuick.Layouts 1.0;
|
||||
import QtWebEngine 1.0
|
||||
import QtWebEngine.experimental 1.0
|
||||
import QtQuick.Window 2.0;
|
||||
|
||||
Rectangle {
|
||||
id: window
|
||||
anchors.fill: parent
|
||||
color: "#00000000"
|
||||
|
||||
property var title: ""
|
||||
property var iconSource: "../browser.png"
|
||||
property var menuItem
|
||||
property var hideUrl: true
|
||||
|
||||
property alias url: webview.url
|
||||
property alias windowTitle: webview.title
|
||||
property alias webView: webview
|
||||
|
||||
property var cleanPath: false
|
||||
property var open: function(url) {
|
||||
if(!window.cleanPath) {
|
||||
var uri = url;
|
||||
if(!/.*\:\/\/.*/.test(uri)) {
|
||||
uri = "http://" + uri;
|
||||
}
|
||||
|
||||
var reg = /(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.eth)(.*)/
|
||||
|
||||
if(reg.test(uri)) {
|
||||
uri.replace(reg, function(match, pre, domain, path) {
|
||||
uri = pre;
|
||||
|
||||
var lookup = eth.lookupDomain(domain.substring(0, domain.length - 4));
|
||||
var ip = [];
|
||||
for(var i = 0, l = lookup.length; i < l; i++) {
|
||||
ip.push(lookup.charCodeAt(i))
|
||||
}
|
||||
|
||||
if(ip.length != 0) {
|
||||
uri += lookup;
|
||||
} else {
|
||||
uri += domain;
|
||||
}
|
||||
|
||||
uri += path;
|
||||
});
|
||||
}
|
||||
|
||||
window.cleanPath = true;
|
||||
|
||||
webview.url = uri;
|
||||
|
||||
//uriNav.text = uri.text.replace(/(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.\w{2,3})(.*)/, "$1$2<span style='color:#CCC'>$3</span>");
|
||||
uriNav.text = uri;
|
||||
|
||||
} else {
|
||||
// Prevent inf loop.
|
||||
window.cleanPath = false;
|
||||
}
|
||||
}
|
||||
|
||||
function showFullUrlBar(on){
|
||||
if (uriNav.focus == false ) {
|
||||
if (on == false) {
|
||||
clickAnywhereOnApp.visible = false
|
||||
navBar.state = "titleVisible"
|
||||
} else {
|
||||
clickAnywhereOnApp.visible = true
|
||||
navBar.state = "fullUrlVisible"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
}
|
||||
|
||||
Item {
|
||||
objectName: "root"
|
||||
id: root
|
||||
anchors {
|
||||
fill: parent
|
||||
}
|
||||
|
||||
state: "inspectorShown"
|
||||
|
||||
MouseArea {
|
||||
id: clickAnywhereOnApp
|
||||
z:15
|
||||
// Using a secondary screen to catch on mouse exits for the area, because
|
||||
// there are many hover actions conflicting
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
topMargin: 50
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
}
|
||||
hoverEnabled: true
|
||||
|
||||
onEntered: {
|
||||
showFullUrlBar(false);
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
uriNav.focus = false
|
||||
showFullUrlBar(false);
|
||||
}
|
||||
|
||||
// Rectangle {
|
||||
// anchors.fill: parent
|
||||
// color: "#88888888"
|
||||
// }
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: navBar
|
||||
height: 74
|
||||
z: 20
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
Button {
|
||||
id: back
|
||||
z: 30
|
||||
onClicked: {
|
||||
webview.goBack()
|
||||
}
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: 6
|
||||
}
|
||||
|
||||
style: ButtonStyle {
|
||||
background: Image {
|
||||
source: (webview.canGoBack) ?
|
||||
(control.hovered ? "../../backButtonHover.png" : "../../backButton.png") :
|
||||
"../../backButtonDisabled.png"
|
||||
width: 20
|
||||
height: 30
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: appInfoPane
|
||||
height: 28
|
||||
color: "#FFFFFF"
|
||||
radius: 6
|
||||
z:2
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
z: 10
|
||||
hoverEnabled: true
|
||||
|
||||
onEntered: {
|
||||
showFullUrlBar(true);
|
||||
}
|
||||
/*onExited: {
|
||||
showFullUrlBar(false);
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
anchors {
|
||||
left: back.right
|
||||
right: parent.right
|
||||
leftMargin: 10
|
||||
rightMargin: 10
|
||||
}
|
||||
|
||||
Text {
|
||||
id: appTitle
|
||||
text: "LOADING"
|
||||
font.bold: true
|
||||
font.capitalization: Font.AllUppercase
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.horizontalCenter
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
leftMargin: 32
|
||||
}
|
||||
color: "#928484"
|
||||
}
|
||||
|
||||
Text {
|
||||
id: appDomain
|
||||
text: "loading domain"
|
||||
font.bold: false
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideLeft
|
||||
|
||||
anchors {
|
||||
left: parent.horizontalCenter
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
leftMargin: 32
|
||||
|
||||
}
|
||||
color: "#C0AFAF"
|
||||
}
|
||||
|
||||
|
||||
TextField {
|
||||
id: uriNav
|
||||
opacity: 0.0
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 16
|
||||
}
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
style: TextFieldStyle {
|
||||
textColor: "#928484"
|
||||
background: Rectangle {
|
||||
border.width: 0
|
||||
color: "transparent"
|
||||
}
|
||||
}
|
||||
text: webview.url;
|
||||
y: parent.height / 2 - this.height / 2
|
||||
z: 20
|
||||
activeFocusOnPress: true
|
||||
Keys.onReturnPressed: {
|
||||
// if there's no http, add it.
|
||||
var url = this.text,
|
||||
matches = url.match(/^([a-z]*\:\/\/)?([^\/.]+)(:?\/)(.*|$)/i),
|
||||
requestedProtocol = (matches && matches[1] != "undefined")? "" : "http://";
|
||||
|
||||
webview.url = requestedProtocol + url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: appInfoPaneShadow
|
||||
width: 10
|
||||
height: 30
|
||||
color: "#BDB6B6"
|
||||
radius: 6
|
||||
z:1
|
||||
|
||||
anchors {
|
||||
left: back.right
|
||||
right: parent.right
|
||||
leftMargin:10
|
||||
rightMargin:10
|
||||
top: parent.top
|
||||
topMargin: 23
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: navBarBackground
|
||||
anchors.fill: parent
|
||||
z:-1
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0.0; color: "#F6F1F2" }
|
||||
GradientStop { position: 1.0; color: "#DED5D5" }
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "fullUrlVisible"
|
||||
PropertyChanges {
|
||||
target: appTitle
|
||||
anchors.rightMargin: -50
|
||||
opacity: 0.0
|
||||
}
|
||||
PropertyChanges {
|
||||
target: appDomain
|
||||
anchors.leftMargin: -50
|
||||
opacity: 0.0
|
||||
}
|
||||
PropertyChanges {
|
||||
target: uriNav
|
||||
anchors.leftMargin: 0
|
||||
opacity: 1.0
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "titleVisible"
|
||||
|
||||
PropertyChanges {
|
||||
target: appTitle
|
||||
anchors.rightMargin: 10
|
||||
opacity: 1.0
|
||||
}
|
||||
PropertyChanges {
|
||||
target: appDomain
|
||||
anchors.leftMargin: 10
|
||||
opacity: 1.0
|
||||
}
|
||||
PropertyChanges {
|
||||
target: uriNav
|
||||
anchors.leftMargin: -50
|
||||
opacity: 0.0
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
transitions: [
|
||||
// This adds a transition that defaults to applying to all state changes
|
||||
|
||||
Transition {
|
||||
|
||||
// This applies a default NumberAnimation to any changes a state change makes to x or y properties
|
||||
NumberAnimation {
|
||||
properties: "anchors.leftMargin, anchors.rightMargin, opacity"
|
||||
easing.type: Easing.InOutQuad //Easing.InOutBack
|
||||
duration: 300
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
WebEngineView {
|
||||
objectName: "webView"
|
||||
id: webview
|
||||
experimental.settings.javascriptCanAccessClipboard: true
|
||||
//experimental.settings.localContentCanAccessRemoteUrls: true
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
top: navBar.bottom
|
||||
}
|
||||
z: 10
|
||||
|
||||
Timer {
|
||||
interval: 2000; running: true; repeat: true
|
||||
onTriggered: {
|
||||
webview.runJavaScript("try{document.querySelector('meta[name=ethereum-dapp-info]').getAttribute('content')}catch(e){}", function(extraInfo) {
|
||||
if (extraInfo) {
|
||||
menuItem.secondaryTitle = extraInfo;
|
||||
}
|
||||
});
|
||||
webview.runJavaScript("try{document.querySelector('meta[name=ethereum-dapp-badge]').getAttribute('content')}catch(e){}", function(badge) {
|
||||
if (badge) {
|
||||
if (Number(badge)>0 && Number(badge)<999) {
|
||||
menuItem.badgeNumber = Number(badge);
|
||||
menuItem.badgeContent = "number"
|
||||
} else if (badge == "warning") {
|
||||
menuItem.badgeIcon = "\ue00e"
|
||||
menuItem.badgeContent = "icon"
|
||||
|
||||
} else if (badge == "ghost") {
|
||||
menuItem.badgeIcon = "\ue01a"
|
||||
menuItem.badgeContent = "icon"
|
||||
|
||||
} else if (badge == "question") {
|
||||
menuItem.badgeIcon = "\ue05d"
|
||||
menuItem.badgeContent = "icon"
|
||||
|
||||
} else if (badge == "info") {
|
||||
menuItem.badgeIcon = "\ue08b"
|
||||
menuItem.badgeContent = "icon"
|
||||
|
||||
} else if (badge == "check") {
|
||||
menuItem.badgeIcon = "\ue080"
|
||||
menuItem.badgeContent = "icon"
|
||||
|
||||
} else if (badge == "gear") {
|
||||
menuItem.badgeIcon = "\ue09a"
|
||||
menuItem.badgeContent = "icon"
|
||||
|
||||
} else {
|
||||
menuItem.badgeContent = ""
|
||||
}
|
||||
} else {
|
||||
menuItem.badgeContent = ""
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onLoadingChanged: {
|
||||
if (loadRequest.status == WebEngineView.LoadSucceededStatus) {
|
||||
|
||||
webview.runJavaScript("document.title", function(pageTitle) {
|
||||
menuItem.title = pageTitle;
|
||||
});
|
||||
|
||||
webView.runJavaScript("try{document.querySelector(\"link[rel='icon']\").getAttribute(\"href\")}catch(e){}", function(sideIcon){
|
||||
if(sideIcon){
|
||||
menuItem.icon = webview.url + sideIcon;
|
||||
};
|
||||
});
|
||||
|
||||
webView.runJavaScript("try{document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")}catch(e){}", function(topBarStyle){
|
||||
if (!topBarStyle) {
|
||||
showFullUrlBar(true);
|
||||
navBarBackground.visible = true;
|
||||
back.visible = true;
|
||||
appInfoPane.anchors.leftMargin = 0;
|
||||
appInfoPaneShadow.anchors.leftMargin = 0;
|
||||
webview.anchors.topMargin = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (topBarStyle=="transparent") {
|
||||
// Adjust for a transparent sidebar Dapp
|
||||
navBarBackground.visible = false;
|
||||
back.visible = false;
|
||||
appInfoPane.anchors.leftMargin = -16;
|
||||
appInfoPaneShadow.anchors.leftMargin = -16;
|
||||
webview.anchors.topMargin = -74;
|
||||
webview.runJavaScript("document.querySelector('body').classList.add('ethereum-dapp-url-bar-style-transparent')")
|
||||
|
||||
} else {
|
||||
navBarBackground.visible = true;
|
||||
back.visible = true;
|
||||
appInfoPane.anchors.leftMargin = 0;
|
||||
appInfoPaneShadow.anchors.leftMargin = 0;
|
||||
webview.anchors.topMargin = 0;
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
webview.runJavaScript(eth.readFile("bignumber.min.js"));
|
||||
webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js"));
|
||||
webview.runJavaScript(eth.readFile("mist.js"));
|
||||
|
||||
var cleanTitle = webview.url.toString()
|
||||
var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
|
||||
var domain = matches && matches[1];
|
||||
|
||||
|
||||
if (domain)
|
||||
appDomain.text = domain //webview.url.replace("a", "z")
|
||||
if (webview.title)
|
||||
appTitle.text = webview.title
|
||||
|
||||
showFullUrlBar(false);
|
||||
}
|
||||
}
|
||||
onJavaScriptConsoleMessage: {
|
||||
console.log(sourceID + ":" + lineNumber + ":" + JSON.stringify(message));
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: sizeGrip
|
||||
color: "gray"
|
||||
visible: false
|
||||
height: 10
|
||||
anchors {
|
||||
left: root.left
|
||||
right: root.right
|
||||
}
|
||||
y: Math.round(root.height * 2 / 3)
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
drag.target: sizeGrip
|
||||
drag.minimumY: 0
|
||||
drag.maximumY: root.height
|
||||
drag.axis: Drag.YAxis
|
||||
}
|
||||
}
|
||||
|
||||
WebEngineView {
|
||||
id: inspector
|
||||
visible: false
|
||||
anchors {
|
||||
left: root.left
|
||||
right: root.right
|
||||
top: sizeGrip.bottom
|
||||
bottom: root.bottom
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "inspectorShown"
|
||||
PropertyChanges {
|
||||
target: inspector
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,144 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Controls.Styles 1.0
|
||||
import QtQuick.Layouts 1.0;
|
||||
import QtWebEngine 1.0
|
||||
import QtWebEngine.experimental 1.0
|
||||
import QtQuick.Window 2.0;
|
||||
|
||||
|
||||
Rectangle {
|
||||
id: window
|
||||
anchors.fill: parent
|
||||
color: "#00000000"
|
||||
|
||||
property var title: "Catalog"
|
||||
property var iconSource: ""
|
||||
property var menuItem
|
||||
property var hideUrl: true
|
||||
|
||||
property alias url: webview.url
|
||||
property alias windowTitle: webview.title
|
||||
property alias webView: webview
|
||||
|
||||
property var cleanPath: false
|
||||
property var open: function(url) {
|
||||
if(!window.cleanPath) {
|
||||
var uri = url;
|
||||
if(!/.*\:\/\/.*/.test(uri)) {
|
||||
uri = "http://" + uri;
|
||||
}
|
||||
|
||||
var reg = /(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.eth)(.*)/
|
||||
|
||||
if(reg.test(uri)) {
|
||||
uri.replace(reg, function(match, pre, domain, path) {
|
||||
uri = pre;
|
||||
|
||||
var lookup = eth.lookupDomain(domain.substring(0, domain.length - 4));
|
||||
var ip = [];
|
||||
for(var i = 0, l = lookup.length; i < l; i++) {
|
||||
ip.push(lookup.charCodeAt(i))
|
||||
}
|
||||
|
||||
if(ip.length != 0) {
|
||||
uri += lookup;
|
||||
} else {
|
||||
uri += domain;
|
||||
}
|
||||
|
||||
uri += path;
|
||||
});
|
||||
}
|
||||
|
||||
window.cleanPath = true;
|
||||
|
||||
webview.url = uri;
|
||||
|
||||
//uriNav.text = uri.text.replace(/(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.\w{2,3})(.*)/, "$1$2<span style='color:#CCC'>$3</span>");
|
||||
uriNav.text = uri;
|
||||
|
||||
} else {
|
||||
// Prevent inf loop.
|
||||
window.cleanPath = false;
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
objectName: "root"
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
state: "inspectorShown"
|
||||
|
||||
WebEngineView {
|
||||
objectName: "webView"
|
||||
id: webview
|
||||
anchors.fill: parent
|
||||
|
||||
property var protocol: "http://"
|
||||
//property var domain: "localhost:3000"
|
||||
property var domain: "ethereum-dapp-catalog.meteor.com"
|
||||
url: protocol + domain
|
||||
|
||||
experimental.settings.javascriptCanAccessClipboard: true
|
||||
|
||||
|
||||
onJavaScriptConsoleMessage: {
|
||||
console.log(sourceID + ":" + lineNumber + ":" + JSON.stringify(message));
|
||||
}
|
||||
|
||||
onNavigationRequested: {
|
||||
// this checks if the domain of the requested link is the same as the catalog's
|
||||
// If it is, it opens on the same window, if it's not it opens a new tab
|
||||
|
||||
var cleanTitle = request.url.toString()
|
||||
var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
|
||||
var requestedDomain = matches && matches[1];
|
||||
|
||||
|
||||
if(request.navigationType==0){
|
||||
|
||||
if (requestedDomain === this.domain){
|
||||
request.action = WebEngineView.AcceptRequest;
|
||||
} else {
|
||||
request.action = WebEngineView.IgnoreRequest;
|
||||
newBrowserTab(request.url);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
onLoadingChanged: {
|
||||
if (loadRequest.status == WebEngineView.LoadSucceededStatus) {
|
||||
webview.runJavaScript(eth.readFile("mist.js"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WebEngineView {
|
||||
id: inspector
|
||||
visible: false
|
||||
z:10
|
||||
anchors {
|
||||
left: root.left
|
||||
right: root.right
|
||||
top: root.top
|
||||
bottom: root.bottom
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "inspectorShown"
|
||||
PropertyChanges {
|
||||
target: inspector
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,244 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Layouts 1.0;
|
||||
import QtQuick.Dialogs 1.0;
|
||||
import QtQuick.Window 2.1;
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import Ethereum 1.0
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
property var title: "Block Chain"
|
||||
property var menuItem
|
||||
|
||||
objectName: "chainView"
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
|
||||
TableView {
|
||||
id: blockTable
|
||||
width: parent.width
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
TableViewColumn{ role: "number" ; title: "#" ; width: 100 }
|
||||
TableViewColumn{ role: "hash" ; title: "Hash" ; width: 560 }
|
||||
TableViewColumn{ role: "txAmount" ; title: "Tx amount" ; width: 100 }
|
||||
|
||||
model: blockModel
|
||||
|
||||
itemDelegate: Item {
|
||||
Text {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 10
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
color: styleData.textColor
|
||||
elide: styleData.elideMode
|
||||
text: styleData.value
|
||||
font.pixelSize: 11
|
||||
MouseArea {
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
propagateComposedEvents: true
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
blockTable.selection.clear()
|
||||
blockTable.selection.select(styleData.row)
|
||||
|
||||
if(mouse.button == Qt.RightButton) {
|
||||
contextMenu.row = styleData.row;
|
||||
contextMenu.popup()
|
||||
}
|
||||
}
|
||||
|
||||
onDoubleClicked: {
|
||||
popup.visible = true
|
||||
popup.setDetails(blockModel.get(styleData.row))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: contextMenu
|
||||
property var row
|
||||
MenuItem {
|
||||
text: "Details"
|
||||
onTriggered: {
|
||||
popup.visible = true
|
||||
popup.setDetails(blockModel.get(contextMenu.row))
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator{}
|
||||
|
||||
MenuItem {
|
||||
text: "Copy"
|
||||
onTriggered: {
|
||||
copyToClipboard(blockModel.get(contextMenu.row).hash)
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Dump State"
|
||||
onTriggered: {
|
||||
generalFileDialog.show(false, function(path) {
|
||||
var hash = blockModel.get(contextMenu.row).hash;
|
||||
|
||||
gui.dumpState(hash, path);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function addBlock(block, initial) {
|
||||
if(initial == undefined){
|
||||
initial = false
|
||||
}
|
||||
|
||||
var amount = block.transactions.length;
|
||||
var txs = [];
|
||||
for(var i = 0; i < block.transactions.length; i++) {
|
||||
var tx = JSON.parse(block.transactions.getAsJson(i));
|
||||
txs.push(tx);
|
||||
}
|
||||
|
||||
if(initial){
|
||||
blockModel.append({raw: block.raw, bloom: block.bloom, size: block.size, number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
|
||||
} else {
|
||||
blockModel.insert(0, {raw: block.raw, bloom: block.bloom, size: block.size, number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
|
||||
}
|
||||
}
|
||||
|
||||
Window {
|
||||
id: popup
|
||||
visible: false
|
||||
//flags: Qt.CustomizeWindowHint | Qt.Tool | Qt.WindowCloseButtonHint
|
||||
property var block
|
||||
width: root.width
|
||||
height: 300
|
||||
Component{
|
||||
id: blockDetailsDelegate
|
||||
Rectangle {
|
||||
color: "#252525"
|
||||
width: popup.width
|
||||
height: 150
|
||||
Column {
|
||||
anchors.leftMargin: 10
|
||||
anchors.topMargin: 5
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
Text { text: '<h3>Block details</h3>'; color: "#F2F2F2"}
|
||||
Text { text: '<b>Block number:</b> ' + number + " (Size: " + size + ")"; color: "#F2F2F2"}
|
||||
Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"}
|
||||
Text { text: '<b>Bloom:</b> ' + bloom; color: "#F2F2F2"}
|
||||
Text { text: '<b>Coinbase:</b> <' + name + '> ' + coinbase; color: "#F2F2F2"}
|
||||
Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"}
|
||||
Text { text: '<b>Gas used:</b> ' + gasUsed + " / " + gasLimit; color: "#F2F2F2"}
|
||||
}
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
model: singleBlock
|
||||
delegate: blockDetailsDelegate
|
||||
anchors.top: parent.top
|
||||
height: 100
|
||||
anchors.leftMargin: 20
|
||||
id: listViewThing
|
||||
Layout.maximumHeight: 40
|
||||
}
|
||||
TableView {
|
||||
id: txView
|
||||
anchors.top: listViewThing.bottom
|
||||
anchors.topMargin: 50
|
||||
width: parent.width
|
||||
|
||||
TableViewColumn{width: 90; role: "value" ; title: "Value" }
|
||||
TableViewColumn{width: 200; role: "hash" ; title: "Hash" }
|
||||
TableViewColumn{width: 200; role: "sender" ; title: "Sender" }
|
||||
TableViewColumn{width: 200;role: "address" ; title: "Receiver" }
|
||||
TableViewColumn{width: 60; role: "gas" ; title: "Gas" }
|
||||
TableViewColumn{width: 60; role: "gasPrice" ; title: "Gas Price" }
|
||||
TableViewColumn{width: 60; role: "isContract" ; title: "Contract" }
|
||||
|
||||
model: transactionModel
|
||||
onClicked: {
|
||||
var tx = transactionModel.get(row)
|
||||
if(tx.data) {
|
||||
popup.showContractData(tx)
|
||||
}else{
|
||||
popup.height = 440
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showContractData(tx) {
|
||||
if(tx.createsContract) {
|
||||
contractData.text = tx.data
|
||||
contractLabel.text = "<h4> Transaction created contract " + tx.address + "</h4>"
|
||||
}else{
|
||||
contractLabel.text = "<h4> Transaction ran contract " + tx.address + "</h4>"
|
||||
contractData.text = tx.rawData
|
||||
}
|
||||
popup.height = 540
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: txDetails
|
||||
width: popup.width
|
||||
height: 300
|
||||
anchors.left: listViewThing.left
|
||||
anchors.top: txView.bottom
|
||||
Label {
|
||||
text: "<h4>Contract data</h4>"
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
id: contractLabel
|
||||
anchors.leftMargin: 10
|
||||
}
|
||||
TextArea {
|
||||
id: contractData
|
||||
text: "Contract"
|
||||
anchors.top: contractLabel.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
wrapMode: Text.Wrap
|
||||
height: 80
|
||||
}
|
||||
TextArea {
|
||||
id: dumpData
|
||||
anchors.top: contractData.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
height: 300
|
||||
}
|
||||
}
|
||||
property var transactionModel: ListModel {
|
||||
id: transactionModel
|
||||
}
|
||||
property var singleBlock: ListModel {
|
||||
id: singleBlock
|
||||
}
|
||||
function setDetails(bl){
|
||||
singleBlock.set(0, bl)
|
||||
popup.height = 300
|
||||
transactionModel.clear()
|
||||
if(bl.txs !== undefined){
|
||||
for(var i = 0; i < bl.txs.count; i++) {
|
||||
transactionModel.insert(0, bl.txs.get(i))
|
||||
}
|
||||
if(bl.txs.count > 0 && bl.txs.get(0).data){
|
||||
popup.showContractData(bl.txs.get(0))
|
||||
}
|
||||
}
|
||||
txView.forceActiveFocus()
|
||||
dumpData.text = bl.raw;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Layouts 1.0;
|
||||
import QtQuick.Dialogs 1.0;
|
||||
import QtQuick.Window 2.1;
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import Ethereum 1.0
|
||||
|
||||
Rectangle {
|
||||
property var title: "Transactions"
|
||||
property var menuItem
|
||||
|
||||
|
||||
id: historyView
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
objectName: "transactionView"
|
||||
|
||||
property var txModel: ListModel {
|
||||
id: txModel
|
||||
}
|
||||
TableView {
|
||||
id: txTableView
|
||||
anchors.fill: parent
|
||||
TableViewColumn{ role: "inout" ; title: "" ; width: 40 }
|
||||
TableViewColumn{ role: "value" ; title: "Value" ; width: 100 }
|
||||
TableViewColumn{ role: "address" ; title: "Address" ; width: 430 }
|
||||
TableViewColumn{ role: "contract" ; title: "Contract" ; width: 100 }
|
||||
|
||||
model: txModel
|
||||
}
|
||||
|
||||
function addTx(tx, inout) {
|
||||
var isContract
|
||||
if (tx.contract == true){
|
||||
isContract = "Yes"
|
||||
}else{
|
||||
isContract = "No"
|
||||
}
|
||||
|
||||
|
||||
var address;
|
||||
if(inout == "recv") {
|
||||
address = tx.sender;
|
||||
} else {
|
||||
address = tx.address;
|
||||
}
|
||||
|
||||
txModel.insert(0, {inout: inout, hash: tx.hash, address: address, value: tx.value, contract: isContract})
|
||||
}
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Layouts 1.0;
|
||||
import QtQuick.Dialogs 1.0;
|
||||
import QtQuick.Window 2.1;
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import Ethereum 1.0
|
||||
|
||||
Rectangle {
|
||||
property var title: "Debug Info"
|
||||
property var menuItem
|
||||
|
||||
objectName: "infoView"
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
|
||||
color: "#00000000"
|
||||
|
||||
Column {
|
||||
id: info
|
||||
spacing: 3
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 5
|
||||
anchors.leftMargin: 5
|
||||
|
||||
Label {
|
||||
id: addressLabel
|
||||
text: "Address"
|
||||
}
|
||||
TextField {
|
||||
text: eth.coinbase()
|
||||
width: 500
|
||||
}
|
||||
|
||||
TextArea {
|
||||
objectName: "statsPane"
|
||||
width: parent.width
|
||||
height: 200
|
||||
selectByMouse: true
|
||||
readOnly: true
|
||||
font.family: "Courier"
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: logLayout
|
||||
width: parent.width
|
||||
height: 200
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
TableView {
|
||||
id: addressView
|
||||
width: parent.width
|
||||
height: 200
|
||||
anchors {
|
||||
left: parent.left
|
||||
bottom: parent.bottom
|
||||
top: parent.top
|
||||
}
|
||||
TableViewColumn{ role: "name"; title: "name" }
|
||||
TableViewColumn{ role: "address"; title: "address"; width: 300}
|
||||
|
||||
property var addressModel: ListModel {
|
||||
id: addressModel
|
||||
}
|
||||
|
||||
model: addressModel
|
||||
itemDelegate: Item {
|
||||
Text {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 10
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
color: styleData.textColor
|
||||
elide: styleData.elideMode
|
||||
text: styleData.value
|
||||
font.pixelSize: 11
|
||||
MouseArea {
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
propagateComposedEvents: true
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
addressView.selection.clear()
|
||||
addressView.selection.select(styleData.row)
|
||||
|
||||
if(mouse.button == Qt.RightButton) {
|
||||
contextMenu.row = styleData.row;
|
||||
contextMenu.popup()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: contextMenu
|
||||
property var row;
|
||||
|
||||
MenuItem {
|
||||
text: "Copy"
|
||||
onTriggered: {
|
||||
copyToClipboard(addressModel.get(this.row).address)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property var logModel: ListModel {
|
||||
id: logModel
|
||||
}
|
||||
|
||||
function addDebugMessage(message){
|
||||
debuggerLog.append({value: message})
|
||||
}
|
||||
|
||||
function addAddress(address) {
|
||||
addressModel.append({name: address.name, address: address.address})
|
||||
}
|
||||
|
||||
function clearAddress() {
|
||||
addressModel.clear()
|
||||
}
|
||||
|
||||
function addLog(str) {
|
||||
// Remove first item once we've reached max log items
|
||||
if(logModel.count > 250) {
|
||||
logModel.remove(0)
|
||||
}
|
||||
|
||||
if(str.len != 0) {
|
||||
if(logView.flickableItem.atYEnd) {
|
||||
logModel.append({description: str})
|
||||
logView.positionViewAtRow(logView.rowCount - 1, ListView.Contain)
|
||||
} else {
|
||||
logModel.append({description: str})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 82 KiB |
|
@ -1,190 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Layouts 1.0;
|
||||
import QtQuick.Dialogs 1.0;
|
||||
import QtQuick.Window 2.1;
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
property var title: "JeffCoin"
|
||||
property var iconSource: "./views/jeffcoin/jeff.png"
|
||||
property var menuItem
|
||||
property var filter
|
||||
property var address: "fc0a9436890478bb9b1c6ed7455c2535366f4a99"
|
||||
|
||||
function insertTx(message, blockNumber) {
|
||||
if(!message) return;
|
||||
|
||||
var from = message.from
|
||||
var to = message.input.substr(24, 40)
|
||||
var value = eth.fromNumber(message.input.substr(64, 64))
|
||||
|
||||
var me = eth.key().address;
|
||||
if((to == me|| from == me) && message.input.length == 128) {
|
||||
var to = eth.lookupName(to)
|
||||
var from = eth.lookupName(from)
|
||||
txModel.insert(0, {confirmations: blockNumber - message.number, from: from, to: to, value: value})
|
||||
}
|
||||
}
|
||||
|
||||
function setBalance() {
|
||||
var jeffCoinAmount = eth.fromNumber(eth.storageAt(address, eth.key().address)) + " JΞF"
|
||||
menuItem.secondaryTitle = jeffCoinAmount
|
||||
|
||||
balance.text = "<b>Balance</b>: " + jeffCoinAmount;
|
||||
}
|
||||
|
||||
function onReady() {
|
||||
setBalance()
|
||||
|
||||
filter = new ethx.watch({latest: -1, to: address})
|
||||
filter.changed(function(messages) {
|
||||
setBalance()
|
||||
|
||||
var blockNumber = eth.block(-1).number;
|
||||
for(var i = 0; i < messages.length; i++) {
|
||||
insertTx(messages.get(i), blockNumber);
|
||||
}
|
||||
});
|
||||
|
||||
var blockNumber = eth.block(-1).number;
|
||||
var msgs = filter.messages()
|
||||
for(var i = msgs.length-1; i >= 0; i--) {
|
||||
var message = JSON.parse(msgs.getAsJson(i))
|
||||
|
||||
insertTx(message, blockNumber)
|
||||
}
|
||||
|
||||
var chainChanged = ethx.watch("chain")
|
||||
chainChanged.changed(function() {
|
||||
for(var i = 0; i < txModel.count; i++) {
|
||||
var entry = txModel.get(i);
|
||||
entry.confirmations++;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onDestroy() {
|
||||
filter.uninstall()
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 10
|
||||
y: 40
|
||||
anchors.fill: parent
|
||||
|
||||
Text {
|
||||
id: balance
|
||||
text: "<b>Balance</b>: " + eth.fromNumber(eth.storageAt(address, eth.key().address)) + " JΞF"
|
||||
font.pixelSize: 24
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
top: parent.top
|
||||
topMargin: 20
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: newTxPane
|
||||
color: "#ececec"
|
||||
border.color: "#cccccc"
|
||||
border.width: 1
|
||||
anchors {
|
||||
top: balance.bottom
|
||||
topMargin: 10
|
||||
left: parent.left
|
||||
leftMargin: 5
|
||||
right: parent.right
|
||||
rightMargin: 5
|
||||
}
|
||||
height: 100
|
||||
|
||||
RowLayout {
|
||||
id: amountFields
|
||||
spacing: 10
|
||||
anchors {
|
||||
top: parent.top
|
||||
topMargin: 20
|
||||
left: parent.left
|
||||
leftMargin: 20
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "JΞF "
|
||||
}
|
||||
|
||||
// There's something off with the row layout where textfields won't listen to the width setting
|
||||
Rectangle {
|
||||
width: 50
|
||||
height: 20
|
||||
TextField {
|
||||
id: txValue
|
||||
width: parent.width
|
||||
placeholderText: "0.00"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: toFields
|
||||
spacing: 10
|
||||
anchors {
|
||||
top: amountFields.bottom
|
||||
topMargin: 5
|
||||
left: parent.left
|
||||
leftMargin: 20
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "To"
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 200
|
||||
height: 20
|
||||
TextField {
|
||||
id: txTo
|
||||
width: parent.width
|
||||
placeholderText: "Address or name"
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Send"
|
||||
onClicked: {
|
||||
var lookup = eth.lookupAddress(address)
|
||||
if(lookup.length == 0)
|
||||
lookup = address
|
||||
|
||||
eth.transact({from: eth.key().privateKey, to:lookup, gas: "9000", gasPrice: "10000000000000", data: ["0x"+txTo.text, txValue.text]})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: newTxPane.bottom
|
||||
topMargin: 10
|
||||
bottom: parent.bottom
|
||||
}
|
||||
TableView {
|
||||
id: txTableView
|
||||
anchors.fill : parent
|
||||
TableViewColumn{ role: "value" ; title: "Amount" ; width: 100 }
|
||||
TableViewColumn{ role: "from" ; title: "From" ; width: 280 }
|
||||
TableViewColumn{ role: "to" ; title: "To" ; width: 280 }
|
||||
TableViewColumn{ role: "confirmations" ; title: "Confirmations" ; width: 100 }
|
||||
|
||||
model: ListModel {
|
||||
id: txModel
|
||||
Component.onCompleted: {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,283 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Layouts 1.0;
|
||||
import QtQuick.Dialogs 1.0;
|
||||
import QtQuick.Window 2.1;
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import Ethereum 1.0
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
property var title: "Miner"
|
||||
property var iconSource: "../mining-icon.png"
|
||||
property var menuItem
|
||||
|
||||
color: "#00000000"
|
||||
|
||||
Label {
|
||||
visible: false
|
||||
id: lastBlockLabel
|
||||
objectName: "lastBlockLabel"
|
||||
text: "---"
|
||||
onTextChanged: {
|
||||
//menuItem.secondaryTitle = text
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 10
|
||||
anchors.fill: parent
|
||||
|
||||
Rectangle {
|
||||
id: mainPane
|
||||
color: "#00000000"
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: localTxPane.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: menu
|
||||
height: 25
|
||||
anchors {
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: tools
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Start"
|
||||
onClicked: {
|
||||
// eth.setGasPrice(minGasPrice.text || "10000000000000");
|
||||
// eth.setExtra(blockExtra.text)
|
||||
if (eth.toggleMining()) {
|
||||
this.text = "Stop";
|
||||
} else {
|
||||
this.text = "Start";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Rectangle {
|
||||
// id: minGasPriceRect
|
||||
// anchors.top: parent.top
|
||||
// anchors.topMargin: 2
|
||||
// width: 200
|
||||
// TextField {
|
||||
// id: minGasPrice
|
||||
// placeholderText: "Min Gas: 10000000000000"
|
||||
// width: 200
|
||||
// validator: RegExpValidator { regExp: /\d*/ }
|
||||
// }
|
||||
// }
|
||||
|
||||
// Rectangle {
|
||||
// width: 300
|
||||
// anchors {
|
||||
// left: minGasPriceRect.right
|
||||
// leftMargin: 5
|
||||
// top: parent.top
|
||||
// topMargin: 2
|
||||
// }
|
||||
|
||||
// TextField {
|
||||
// id: blockExtra
|
||||
// placeholderText: "Extra"
|
||||
// width: parent.width
|
||||
// maximumLength: 1024
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: menu.bottom
|
||||
topMargin: 5
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "<b>Merged mining options</b>"
|
||||
}
|
||||
|
||||
TableView {
|
||||
id: mergedMiningTable
|
||||
height: 300
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
Component {
|
||||
id: checkBoxDelegate
|
||||
|
||||
Item {
|
||||
id: test
|
||||
CheckBox {
|
||||
anchors.fill: parent
|
||||
checked: styleData.value
|
||||
|
||||
onClicked: {
|
||||
var model = mergedMiningModel.get(styleData.row)
|
||||
|
||||
if (this.checked) {
|
||||
model.id = txModel.createLocalTx(model.address, "0", "5000", "0", "")
|
||||
} else {
|
||||
txModel.removeWithId(model.id);
|
||||
model.id = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TableViewColumn{ role: "checked" ; title: "" ; width: 40 ; delegate: checkBoxDelegate }
|
||||
TableViewColumn{ role: "name" ; title: "Name" ; width: 480 }
|
||||
model: ListModel {
|
||||
objectName: "mergedMiningModel"
|
||||
id: mergedMiningModel
|
||||
function addMergedMiningOption(model) {
|
||||
this.append(model);
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
/*
|
||||
// XXX Temp. replace with above eventually
|
||||
var tmpItems = ["JEVCoin", "Some coin", "Other coin", "Etc coin"];
|
||||
var address = "e6716f9544a56c530d868e4bfbacb172315bdead";
|
||||
for (var i = 0; i < tmpItems.length; i++) {
|
||||
mergedMiningModel.append({checked: false, name: tmpItems[i], address: address, id: 0, itemId: i});
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: localTxPane
|
||||
color: "#ececec"
|
||||
border.color: "#cccccc"
|
||||
border.width: 1
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
height: 300
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 10
|
||||
anchors.fill: parent
|
||||
RowLayout {
|
||||
id: newLocalTx
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: 5
|
||||
top: parent.top
|
||||
topMargin: 5
|
||||
bottomMargin: 5
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Local tx"
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 250
|
||||
color: "#00000000"
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 2
|
||||
|
||||
TextField {
|
||||
id: to
|
||||
placeholderText: "To"
|
||||
width: 250
|
||||
validator: RegExpValidator { regExp: /[abcdefABCDEF1234567890]*/ }
|
||||
}
|
||||
}
|
||||
TextField {
|
||||
property var defaultGas: "5000"
|
||||
id: gas
|
||||
placeholderText: "Gas"
|
||||
text: defaultGas
|
||||
validator: RegExpValidator { regExp: /\d*/ }
|
||||
}
|
||||
TextField {
|
||||
id: gasPrice
|
||||
placeholderText: "Price"
|
||||
validator: RegExpValidator { regExp: /\d*/ }
|
||||
}
|
||||
TextField {
|
||||
id: value
|
||||
placeholderText: "Amount"
|
||||
text: "0"
|
||||
validator: RegExpValidator { regExp: /\d*/ }
|
||||
}
|
||||
TextField {
|
||||
id: data
|
||||
placeholderText: "Data"
|
||||
validator: RegExpValidator { regExp: /[abcdefABCDEF1234567890]*/ }
|
||||
}
|
||||
Button {
|
||||
text: "Create"
|
||||
onClicked: {
|
||||
if (to.text.length == 40 && gasPrice.text.length != 0 && value.text.length != 0 && gas.text.length != 0) {
|
||||
txModel.createLocalTx(to.text, gasPrice.text, gas.text, value.text, data.text);
|
||||
|
||||
to.text = ""; gasPrice.text = "";
|
||||
gas.text = gas.defaultGas;
|
||||
value.text = "0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TableView {
|
||||
id: txTableView
|
||||
anchors {
|
||||
top: newLocalTx.bottom
|
||||
topMargin: 5
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
TableViewColumn{ role: "to" ; title: "To" ; width: 480 }
|
||||
TableViewColumn{ role: "gas" ; title: "Gas" ; width: 100 }
|
||||
TableViewColumn{ role: "gasPrice" ; title: "Gas Price" ; width: 100 }
|
||||
TableViewColumn{ role: "value" ; title: "Amount" ; width: 100 }
|
||||
TableViewColumn{ role: "data" ; title: "Data" ; width: 100 }
|
||||
|
||||
model: ListModel {
|
||||
id: txModel
|
||||
Component.onCompleted: {
|
||||
}
|
||||
function removeWithId(id) {
|
||||
for (var i = 0; i < this.count; i++) {
|
||||
if (txModel.get(i).id == id) {
|
||||
this.remove(i);
|
||||
eth.removeLocalTransaction(id)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createLocalTx(to, gasPrice, gas, value, data) {
|
||||
var id = eth.addLocalTransaction(to, data, gas, gasPrice, value)
|
||||
txModel.insert(0, {to: to, gas: gas, gasPrice: gasPrice, value: value, data: data, id: id});
|
||||
|
||||
return id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|