Browse Source

changed name for ethutil hex functions; and access to keyring via keyManager

zelig 11 years ago
parent
commit
098f7f23ce

+ 2 - 2
ethereal/ui/debugger.go

@@ -49,7 +49,7 @@ func (self *DebuggerWindow) SetData(data string) {
 	self.win.Set("dataText", data)
 	self.win.Set("dataText", data)
 }
 }
 func (self *DebuggerWindow) SetAsm(data string) {
 func (self *DebuggerWindow) SetAsm(data string) {
-	dis := ethchain.Disassemble(ethutil.FromHex(data))
+	dis := ethchain.Disassemble(ethutil.Hex2Bytes(data))
 	for _, str := range dis {
 	for _, str := range dis {
 		self.win.Root().Call("setAsm", str)
 		self.win.Root().Call("setAsm", str)
 	}
 	}
@@ -101,7 +101,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
 		gasPrice = ethutil.Big(gasPriceStr)
 		gasPrice = ethutil.Big(gasPriceStr)
 		value    = ethutil.Big(valueStr)
 		value    = ethutil.Big(valueStr)
 		// Contract addr as test address
 		// 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 = ethchain.NewContractCreationTx(ethutil.Big(valueStr), gas, gasPrice, script)
 	)
 	)
 	callerTx.Sign(keyPair.PrivateKey)
 	callerTx.Sign(keyPair.PrivateKey)

+ 2 - 2
ethereal/ui/ext_app.go

@@ -121,10 +121,10 @@ out:
 func (app *ExtApplication) Watch(addr, storageAddr string) {
 func (app *ExtApplication) Watch(addr, storageAddr string) {
 	var event string
 	var event string
 	if len(storageAddr) == 0 {
 	if len(storageAddr) == 0 {
-		event = "object:" + string(ethutil.FromHex(addr))
+		event = "object:" + string(ethutil.Hex2Bytes(addr))
 		app.lib.eth.Reactor().Subscribe(event, app.changeChan)
 		app.lib.eth.Reactor().Subscribe(event, app.changeChan)
 	} else {
 	} 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)
 		app.lib.eth.Reactor().Subscribe(event, app.changeChan)
 	}
 	}
 
 

+ 1 - 1
ethereal/ui/html_container.go

@@ -116,7 +116,7 @@ func (app *HtmlApplication) Window() *qml.Window {
 }
 }
 
 
 func (app *HtmlApplication) NewBlock(block *ethchain.Block) {
 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)
 	app.webView.Call("onNewBlockCb", b)
 }
 }
 
 

+ 1 - 1
ethereal/ui/qml_app.go

@@ -38,7 +38,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) {
 
 
 // Events
 // Events
 func (app *QmlApplication) NewBlock(block *ethchain.Block) {
 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)
 	app.win.Call("onNewBlockCb", pblock)
 }
 }
 
 

+ 2 - 2
ethereal/ui/ui_lib.go

@@ -77,9 +77,9 @@ func (ui *UiLib) AssetPath(p string) string {
 
 
 func (self *UiLib) StartDbWithContractAndData(contractHash, data string) {
 func (self *UiLib) StartDbWithContractAndData(contractHash, data string) {
 	dbWindow := NewDebuggerWindow(self)
 	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 {
 	if len(object.Script()) > 0 {
-		dbWindow.SetCode("0x" + ethutil.Hex(object.Script()))
+		dbWindow.SetCode("0x" + ethutil.Bytes2Hex(object.Script()))
 	}
 	}
 	dbWindow.SetData("0x" + data)
 	dbWindow.SetData("0x" + data)