aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/mist/assets/qml/views/pending_tx.qml
blob: 3dcedeff2fc1269e099a97828632dffda728db84 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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: "Pending Transactions"
    property var menuItem

    objectName: "pendingTxView"
    anchors.fill: parent
    visible: false
    id: pendingTxView

    property var pendingTxModel: ListModel {
        id: pendingTxModel
    }

    TableView {
        id: pendingTxTableView
        anchors.fill: parent
        TableViewColumn{ role: "value" ; title: "Value" ; width: 100 }
        TableViewColumn{ role: "from" ; title: "sender" ; width: 230 }
        TableViewColumn{ role: "to" ; title: "Reciever" ; width: 230 }
        TableViewColumn{ role: "contract" ; title: "Contract" ; width: 100 }

        model: pendingTxModel
    }

    function addTx(tx, inout) {
        var isContract
        if (tx.contract == true){
            isContract = "Yes"
        }else{
            isContract = "No"
        }


        pendingTxModel.insert(0, {hash: tx.hash, to: tx.address, from: tx.sender, value: tx.value, contract: isContract})
    }

    function removeTx(tx) {
        for (var i = 0; i < pendingTxModel.count; i++) {
            if (tx.hash === pendingTxModel.get(i).hash) {
                pendingTxModel.remove(i);
                break;
            }
        }
    }
}