Added isContract to gui

pull/33/merge
Maran 11 years ago
parent 3f82d5172f
commit ab8d96258e
  1. 9
      ethereal/assets/qml/wallet.qml
  2. 4
      ethereal/ui/gui.go

@ -140,6 +140,7 @@ ApplicationWindow {
anchors.fill: parent anchors.fill: parent
TableViewColumn{ role: "value" ; title: "Value" ; width: 100 } TableViewColumn{ role: "value" ; title: "Value" ; width: 100 }
TableViewColumn{ role: "address" ; title: "Address" ; width: 430 } TableViewColumn{ role: "address" ; title: "Address" ; width: 430 }
TableViewColumn{ role: "contract" ; title: "Contract" ; width: 100 }
model: txModel model: txModel
} }
@ -448,7 +449,13 @@ ApplicationWindow {
} }
function addTx(tx) { function addTx(tx) {
txModel.insert(0, {hash: tx.hash, address: tx.address, value: tx.value}) var isContract
if (tx.contract == true){
isContract = "Yes"
}else{
isContract = "No"
}
txModel.insert(0, {hash: tx.hash, address: tx.address, value: tx.value, contract: isContract})
} }
function addBlock(block) { function addBlock(block) {

@ -21,13 +21,15 @@ type Block struct {
type Tx struct { type Tx struct {
Value, Hash, Address string Value, Hash, Address string
Contract bool
} }
func NewTxFromTransaction(tx *ethchain.Transaction) *Tx { func NewTxFromTransaction(tx *ethchain.Transaction) *Tx {
hash := hex.EncodeToString(tx.Hash()) hash := hex.EncodeToString(tx.Hash())
sender := hex.EncodeToString(tx.Recipient) sender := hex.EncodeToString(tx.Recipient)
isContract := len(tx.Data) > 0
return &Tx{Hash: hash, Value: ethutil.CurrencyToString(tx.Value), Address: sender} return &Tx{Hash: hash, Value: ethutil.CurrencyToString(tx.Value), Address: sender, Contract: isContract}
} }
// Creates a new QML Block from a chain block // Creates a new QML Block from a chain block

Loading…
Cancel
Save