Merge branch 'jsonrpc' into qt5.4

This commit is contained in:
obscuren
2015-01-28 18:36:41 +01:00
17 changed files with 299 additions and 348 deletions

View File

@ -44,7 +44,7 @@ type AppContainer interface {
}
type ExtApplication struct {
*xeth.JSXEth
*xeth.XEth
eth core.EthManager
events event.Subscription
@ -58,7 +58,7 @@ type ExtApplication struct {
func NewExtApplication(container AppContainer, lib *UiLib) *ExtApplication {
return &ExtApplication{
JSXEth: xeth.NewJSXEth(lib.eth),
XEth: xeth.New(lib.eth),
eth: lib.eth,
watcherQuitChan: make(chan bool),
filters: make(map[string]*core.Filter),

View File

@ -75,7 +75,7 @@ type Gui struct {
logLevel logger.LogLevel
open bool
xeth *xeth.JSXEth
xeth *xeth.XEth
Session string
clientIdentity *p2p.SimpleClientIdentity
@ -93,7 +93,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
panic(err)
}
xeth := xeth.NewJSXEth(ethereum)
xeth := xeth.New(ethereum)
gui := &Gui{eth: ethereum,
txDb: db,
xeth: xeth,
@ -120,9 +120,9 @@ func (gui *Gui) Start(assetPath string) {
// Register ethereum functions
qml.RegisterTypes("Ethereum", 1, 0, []qml.TypeSpec{{
Init: func(p *xeth.JSBlock, obj qml.Object) { p.Number = 0; p.Hash = "" },
Init: func(p *xeth.Block, obj qml.Object) { p.Number = 0; p.Hash = "" },
}, {
Init: func(p *xeth.JSTransaction, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" },
Init: func(p *xeth.Transaction, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" },
}, {
Init: func(p *xeth.KeyVal, obj qml.Object) { p.Key = ""; p.Value = "" },
}})
@ -276,7 +276,7 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) {
}
var (
ptx = xeth.NewJSTx(tx)
ptx = xeth.NewTx(tx)
send = ethutil.Bytes2Hex(tx.From())
rec = ethutil.Bytes2Hex(tx.To())
)
@ -303,7 +303,7 @@ func (gui *Gui) readPreviousTransactions() {
func (gui *Gui) processBlock(block *types.Block, initial bool) {
name := ethutil.Bytes2Hex(block.Coinbase())
b := xeth.NewJSBlock(block)
b := xeth.NewBlock(block)
b.Name = name
gui.getObjectByName("chainView").Call("addBlock", b, initial)

View File

@ -140,7 +140,7 @@ func (app *HtmlApplication) Window() *qml.Window {
}
func (app *HtmlApplication) NewBlock(block *types.Block) {
b := &xeth.JSBlock{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())}
b := &xeth.Block{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())}
app.webView.Call("onNewBlockCb", b)
}

View File

@ -70,7 +70,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) {
// Events
func (app *QmlApplication) NewBlock(block *types.Block) {
pblock := &xeth.JSBlock{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())}
pblock := &xeth.Block{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())}
app.win.Call("onNewBlockCb", pblock)
}

View File

@ -42,7 +42,7 @@ type memAddr struct {
// UI Library that has some basic functionality exposed
type UiLib struct {
*xeth.JSXEth
*xeth.XEth
engine *qml.Engine
eth *eth.Ethereum
connected bool
@ -61,7 +61,7 @@ type UiLib struct {
}
func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib {
lib := &UiLib{JSXEth: xeth.NewJSXEth(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*xeth.JSFilter)}
lib := &UiLib{XEth: xeth.New(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*xeth.JSFilter)}
lib.miner = miner.New(eth.KeyManager().Address(), eth)
lib.filterManager = filter.NewFilterManager(eth.EventMux())
go lib.filterManager.Start()
@ -178,7 +178,7 @@ func (self *UiLib) StartDebugger() {
func (self *UiLib) Transact(params map[string]interface{}) (string, error) {
object := mapToTxParams(params)
return self.JSXEth.Transact(
return self.XEth.Transact(
object["from"],
object["to"],
object["value"],
@ -200,7 +200,7 @@ func (self *UiLib) Compile(code string) (string, error) {
func (self *UiLib) Call(params map[string]interface{}) (string, error) {
object := mapToTxParams(params)
return self.JSXEth.Execute(
return self.XEth.Execute(
object["to"],
object["value"],
object["gas"],
@ -260,7 +260,7 @@ func (self *UiLib) NewFilter(object map[string]interface{}, view *qml.Common) (i
/* TODO remove me
filter := qt.NewFilterFromMap(object, self.eth)
filter.MessageCallback = func(messages state.Messages) {
view.Call("messages", xeth.ToJSMessages(messages), id)
view.Call("messages", xeth.ToMessages(messages), id)
}
id = self.filterManager.InstallFilter(filter)
return id
@ -284,7 +284,7 @@ func (self *UiLib) Messages(id int) *ethutil.List {
/* TODO remove me
filter := self.filterManager.GetFilter(id)
if filter != nil {
messages := xeth.ToJSMessages(filter.Find())
messages := xeth.ToMessages(filter.Find())
return messages
}

View File

@ -194,7 +194,7 @@ func KeyTasks(keyManager *crypto.KeyManager, KeyRing string, GenAddr bool, Secre
func StartRpc(ethereum *eth.Ethereum, RpcPort int) {
var err error
ethereum.RpcServer, err = rpchttp.NewRpcHttpServer(xeth.NewJSXEth(ethereum), RpcPort)
ethereum.RpcServer, err = rpchttp.NewRpcHttpServer(xeth.New(ethereum), RpcPort)
if err != nil {
clilogger.Errorf("Could not start RPC interface (port %v): %v", RpcPort, err)
} else {