|
|
@ -9,7 +9,6 @@ import ( |
|
|
|
"github.com/ethereum/eth-go/ethpub" |
|
|
|
"github.com/ethereum/eth-go/ethpub" |
|
|
|
"github.com/ethereum/eth-go/ethutil" |
|
|
|
"github.com/ethereum/eth-go/ethutil" |
|
|
|
"github.com/go-qml/qml" |
|
|
|
"github.com/go-qml/qml" |
|
|
|
"github.com/obscuren/mutan" |
|
|
|
|
|
|
|
"math/big" |
|
|
|
"math/big" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
) |
|
|
|
) |
|
|
@ -55,7 +54,7 @@ func New(ethereum *eth.Ethereum) *Gui { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (gui *Gui) Start(assetPath string) { |
|
|
|
func (gui *Gui) Start(assetPath string) { |
|
|
|
const version = "0.5.0 RC8" |
|
|
|
const version = "0.5.0 RC9" |
|
|
|
|
|
|
|
|
|
|
|
defer gui.txDb.Close() |
|
|
|
defer gui.txDb.Close() |
|
|
|
|
|
|
|
|
|
|
@ -152,7 +151,15 @@ func (gui *Gui) readPreviousTransactions() { |
|
|
|
for it.Next() { |
|
|
|
for it.Next() { |
|
|
|
tx := ethchain.NewTransactionFromBytes(it.Value()) |
|
|
|
tx := ethchain.NewTransactionFromBytes(it.Value()) |
|
|
|
|
|
|
|
|
|
|
|
gui.win.Root().Call("addTx", ethpub.NewPTx(tx)) |
|
|
|
var inout string |
|
|
|
|
|
|
|
if bytes.Compare(tx.Sender(), gui.addr) == 0 { |
|
|
|
|
|
|
|
inout = "send" |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
inout = "recv" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gui.win.Root().Call("addTx", ethpub.NewPTx(tx), inout) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
it.Release() |
|
|
|
it.Release() |
|
|
|
} |
|
|
|
} |
|
|
@ -208,12 +215,12 @@ func (gui *Gui) update() { |
|
|
|
object := state.GetAccount(gui.addr) |
|
|
|
object := state.GetAccount(gui.addr) |
|
|
|
|
|
|
|
|
|
|
|
if bytes.Compare(tx.Sender(), gui.addr) == 0 { |
|
|
|
if bytes.Compare(tx.Sender(), gui.addr) == 0 { |
|
|
|
gui.win.Root().Call("addTx", ethpub.NewPTx(tx)) |
|
|
|
gui.win.Root().Call("addTx", ethpub.NewPTx(tx), "send") |
|
|
|
gui.txDb.Put(tx.Hash(), tx.RlpEncode()) |
|
|
|
gui.txDb.Put(tx.Hash(), tx.RlpEncode()) |
|
|
|
|
|
|
|
|
|
|
|
unconfirmedFunds.Sub(unconfirmedFunds, tx.Value) |
|
|
|
unconfirmedFunds.Sub(unconfirmedFunds, tx.Value) |
|
|
|
} else if bytes.Compare(tx.Recipient, gui.addr) == 0 { |
|
|
|
} else if bytes.Compare(tx.Recipient, gui.addr) == 0 { |
|
|
|
gui.win.Root().Call("addTx", ethpub.NewPTx(tx)) |
|
|
|
gui.win.Root().Call("addTx", ethpub.NewPTx(tx), "recv") |
|
|
|
gui.txDb.Put(tx.Hash(), tx.RlpEncode()) |
|
|
|
gui.txDb.Put(tx.Hash(), tx.RlpEncode()) |
|
|
|
|
|
|
|
|
|
|
|
unconfirmedFunds.Add(unconfirmedFunds, tx.Value) |
|
|
|
unconfirmedFunds.Add(unconfirmedFunds, tx.Value) |
|
|
@ -262,7 +269,5 @@ func (gui *Gui) Transact(recipient, value, gas, gasPrice, data string) (*ethpub. |
|
|
|
func (gui *Gui) Create(recipient, value, gas, gasPrice, data string) (*ethpub.PReceipt, error) { |
|
|
|
func (gui *Gui) Create(recipient, value, gas, gasPrice, data string) (*ethpub.PReceipt, error) { |
|
|
|
keyPair := ethutil.GetKeyRing().Get(0) |
|
|
|
keyPair := ethutil.GetKeyRing().Get(0) |
|
|
|
|
|
|
|
|
|
|
|
mainInput, initInput := mutan.PreParse(data) |
|
|
|
return gui.pub.Create(ethutil.Hex(keyPair.PrivateKey), value, gas, gasPrice, data) |
|
|
|
|
|
|
|
|
|
|
|
return gui.pub.Create(ethutil.Hex(keyPair.PrivateKey), value, gas, gasPrice, initInput, mainInput) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|