From 098f7f23ce62d3f0c60d30d325576de93795cc4b Mon Sep 17 00:00:00 2001
From: zelig <viktor.tron@gmail.com>
Date: Sun, 29 Jun 2014 20:39:45 +0100
Subject: [PATCH] changed name for ethutil hex functions; and access to keyring
 via keyManager

---
 ethereal/ui/debugger.go       | 4 ++--
 ethereal/ui/ext_app.go        | 4 ++--
 ethereal/ui/html_container.go | 2 +-
 ethereal/ui/qml_app.go        | 2 +-
 ethereal/ui/ui_lib.go         | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/ethereal/ui/debugger.go b/ethereal/ui/debugger.go
index 85dd45563..5ad1b4a2c 100644
--- a/ethereal/ui/debugger.go
+++ b/ethereal/ui/debugger.go
@@ -49,7 +49,7 @@ func (self *DebuggerWindow) SetData(data string) {
 	self.win.Set("dataText", data)
 }
 func (self *DebuggerWindow) SetAsm(data string) {
-	dis := ethchain.Disassemble(ethutil.FromHex(data))
+	dis := ethchain.Disassemble(ethutil.Hex2Bytes(data))
 	for _, str := range dis {
 		self.win.Root().Call("setAsm", str)
 	}
@@ -101,7 +101,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
 		gasPrice = ethutil.Big(gasPriceStr)
 		value    = ethutil.Big(valueStr)
 		// Contract addr as test address
-		keyPair  = ethutil.GetKeyRing().Get(0)
+		keyPair  = self.lib.eth.KeyManager().KeyPair()
 		callerTx = ethchain.NewContractCreationTx(ethutil.Big(valueStr), gas, gasPrice, script)
 	)
 	callerTx.Sign(keyPair.PrivateKey)
diff --git a/ethereal/ui/ext_app.go b/ethereal/ui/ext_app.go
index d1a256cdb..0230c46ab 100644
--- a/ethereal/ui/ext_app.go
+++ b/ethereal/ui/ext_app.go
@@ -121,10 +121,10 @@ out:
 func (app *ExtApplication) Watch(addr, storageAddr string) {
 	var event string
 	if len(storageAddr) == 0 {
-		event = "object:" + string(ethutil.FromHex(addr))
+		event = "object:" + string(ethutil.Hex2Bytes(addr))
 		app.lib.eth.Reactor().Subscribe(event, app.changeChan)
 	} else {
-		event = "storage:" + string(ethutil.FromHex(addr)) + ":" + string(ethutil.FromHex(storageAddr))
+		event = "storage:" + string(ethutil.Hex2Bytes(addr)) + ":" + string(ethutil.Hex2Bytes(storageAddr))
 		app.lib.eth.Reactor().Subscribe(event, app.changeChan)
 	}
 
diff --git a/ethereal/ui/html_container.go b/ethereal/ui/html_container.go
index d7dc80af7..f2ebd840c 100644
--- a/ethereal/ui/html_container.go
+++ b/ethereal/ui/html_container.go
@@ -116,7 +116,7 @@ func (app *HtmlApplication) Window() *qml.Window {
 }
 
 func (app *HtmlApplication) NewBlock(block *ethchain.Block) {
-	b := &ethpub.PBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Hex(block.Hash())}
+	b := &ethpub.PBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())}
 	app.webView.Call("onNewBlockCb", b)
 }
 
diff --git a/ethereal/ui/qml_app.go b/ethereal/ui/qml_app.go
index 39ab7f922..d23fdd110 100644
--- a/ethereal/ui/qml_app.go
+++ b/ethereal/ui/qml_app.go
@@ -38,7 +38,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) {
 
 // Events
 func (app *QmlApplication) NewBlock(block *ethchain.Block) {
-	pblock := &ethpub.PBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Hex(block.Hash())}
+	pblock := &ethpub.PBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())}
 	app.win.Call("onNewBlockCb", pblock)
 }
 
diff --git a/ethereal/ui/ui_lib.go b/ethereal/ui/ui_lib.go
index ddc955176..892c1f065 100644
--- a/ethereal/ui/ui_lib.go
+++ b/ethereal/ui/ui_lib.go
@@ -77,9 +77,9 @@ func (ui *UiLib) AssetPath(p string) string {
 
 func (self *UiLib) StartDbWithContractAndData(contractHash, data string) {
 	dbWindow := NewDebuggerWindow(self)
-	object := self.eth.StateManager().CurrentState().GetStateObject(ethutil.FromHex(contractHash))
+	object := self.eth.StateManager().CurrentState().GetStateObject(ethutil.Hex2Bytes(contractHash))
 	if len(object.Script()) > 0 {
-		dbWindow.SetCode("0x" + ethutil.Hex(object.Script()))
+		dbWindow.SetCode("0x" + ethutil.Bytes2Hex(object.Script()))
 	}
 	dbWindow.SetData("0x" + data)
 
-- 
GitLab