further cleaned up xeth interface

This commit is contained in:
obscuren
2015-01-28 18:35:49 +01:00
parent 1146f25015
commit 872b249711
15 changed files with 123 additions and 133 deletions

View File

@ -44,7 +44,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
@ -63,7 +63,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()
@ -180,7 +180,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"],
@ -202,7 +202,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"],
@ -261,7 +261,7 @@ func (self *UiLib) ToAscii(data string) string {
func (self *UiLib) NewFilter(object map[string]interface{}, view *qml.Common) (id int) {
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
@ -279,7 +279,7 @@ func (self *UiLib) NewFilterString(typ string, view *qml.Common) (id int) {
func (self *UiLib) Messages(id int) *ethutil.List {
filter := self.filterManager.GetFilter(id)
if filter != nil {
messages := xeth.ToJSMessages(filter.Find())
messages := xeth.ToMessages(filter.Find())
return messages
}