Moved ethutil => common

This commit is contained in:
obscuren
2015-03-16 11:27:38 +01:00
parent 0b8f66ed9e
commit b523441361
116 changed files with 610 additions and 604 deletions

View File

@ -27,7 +27,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/xeth"
@ -69,7 +69,7 @@ func (self *UiLib) Notef(args []interface{}) {
}
func (self *UiLib) ImportTx(rlpTx string) {
tx := types.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx))
tx := types.NewTransactionFromBytes(common.Hex2Bytes(rlpTx))
err := self.eth.TxPool().Add(tx)
if err != nil {
guilogger.Infoln("import tx failed ", err)
@ -138,12 +138,12 @@ func (self *UiLib) Transact(params map[string]interface{}) (string, error) {
}
func (self *UiLib) Compile(code string) (string, error) {
bcode, err := ethutil.Compile(code, false)
bcode, err := common.Compile(code, false)
if err != nil {
return err.Error(), err
}
return ethutil.Bytes2Hex(bcode), err
return common.Bytes2Hex(bcode), err
}
func (self *UiLib) Call(params map[string]interface{}) (string, error) {
@ -163,8 +163,8 @@ func (self *UiLib) AddLocalTransaction(to, data, gas, gasPrice, value string) in
return 0
/*
return self.miner.AddLocalTx(&miner.LocalTx{
To: ethutil.Hex2Bytes(to),
Data: ethutil.Hex2Bytes(data),
To: common.Hex2Bytes(to),
Data: common.Hex2Bytes(data),
Gas: gas,
GasPrice: gasPrice,
Value: value,
@ -187,7 +187,7 @@ func (self *UiLib) ToggleMining() bool {
}
func (self *UiLib) ToHex(data string) string {
return "0x" + ethutil.Bytes2Hex([]byte(data))
return "0x" + common.Bytes2Hex([]byte(data))
}
func (self *UiLib) ToAscii(data string) string {
@ -195,7 +195,7 @@ func (self *UiLib) ToAscii(data string) string {
if len(data) > 1 && data[0:2] == "0x" {
start = 2
}
return string(ethutil.Hex2Bytes(data[start:]))
return string(common.Hex2Bytes(data[start:]))
}
/// Ethereum filter methods
@ -223,7 +223,7 @@ func (self *UiLib) NewFilterString(typ string, view *qml.Common) (id int) {
return 0
}
func (self *UiLib) Messages(id int) *ethutil.List {
func (self *UiLib) Messages(id int) *common.List {
/* TODO remove me
filter := self.filterManager.GetFilter(id)
if filter != nil {
@ -233,7 +233,7 @@ func (self *UiLib) Messages(id int) *ethutil.List {
}
*/
return ethutil.EmptyList()
return common.EmptyList()
}
func (self *UiLib) ReadFile(p string) string {
@ -275,14 +275,14 @@ func mapToTxParams(object map[string]interface{}) map[string]string {
}
for _, str := range data {
if ethutil.IsHex(str) {
if common.IsHex(str) {
str = str[2:]
if len(str) != 64 {
str = ethutil.LeftPadString(str, 64)
str = common.LeftPadString(str, 64)
}
} else {
str = ethutil.Bytes2Hex(ethutil.LeftPadBytes(ethutil.Big(str).Bytes(), 32))
str = common.Bytes2Hex(common.LeftPadBytes(common.Big(str).Bytes(), 32))
}
dataStr += str