aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/mist
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-16 18:27:38 +0800
committerobscuren <geffobscura@gmail.com>2015-03-16 18:27:38 +0800
commitb5234413611ce5984292f85a01de1f56c045b490 (patch)
treee6e0c6f7fe8358a2dc63cdea11ac66b4f59397f5 /cmd/mist
parent0b8f66ed9ef177dc72442dd7ba337c6733e30344 (diff)
downloadgo-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.gz
go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.zst
go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.zip
Moved ethutil => common
Diffstat (limited to 'cmd/mist')
-rw-r--r--cmd/mist/bindings.go14
-rw-r--r--cmd/mist/gui.go20
-rw-r--r--cmd/mist/html_container.go8
-rw-r--r--cmd/mist/main.go4
-rw-r--r--cmd/mist/qml_container.go4
-rw-r--r--cmd/mist/ui_lib.go26
6 files changed, 38 insertions, 38 deletions
diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go
index b56c0dddf..1371c752c 100644
--- a/cmd/mist/bindings.go
+++ b/cmd/mist/bindings.go
@@ -27,7 +27,7 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/state"
)
@@ -39,13 +39,13 @@ type plugin struct {
func (gui *Gui) Transact(from, recipient, value, gas, gasPrice, d string) (string, error) {
var data string
if len(recipient) == 0 {
- code, err := ethutil.Compile(d, false)
+ code, err := common.Compile(d, false)
if err != nil {
return "", err
}
- data = ethutil.Bytes2Hex(code)
+ data = common.Bytes2Hex(code)
} else {
- data = ethutil.Bytes2Hex(utils.FormatTransactionData(d))
+ data = common.Bytes2Hex(utils.FormatTransactionData(d))
}
return gui.xeth.Transact(from, recipient, value, gas, gasPrice, data)
@@ -55,14 +55,14 @@ func (self *Gui) AddPlugin(pluginPath string) {
self.plugins[pluginPath] = plugin{Name: pluginPath, Path: pluginPath}
json, _ := json.MarshalIndent(self.plugins, "", " ")
- ethutil.WriteFile(self.eth.DataDir+"/plugins.json", json)
+ common.WriteFile(self.eth.DataDir+"/plugins.json", json)
}
func (self *Gui) RemovePlugin(pluginPath string) {
delete(self.plugins, pluginPath)
json, _ := json.MarshalIndent(self.plugins, "", " ")
- ethutil.WriteFile(self.eth.DataDir+"/plugins.json", json)
+ common.WriteFile(self.eth.DataDir+"/plugins.json", json)
}
func (self *Gui) DumpState(hash, path string) {
@@ -76,7 +76,7 @@ func (self *Gui) DumpState(hash, path string) {
i, _ := strconv.Atoi(hash[1:])
block = self.eth.ChainManager().GetBlockByNumber(uint64(i))
} else {
- block = self.eth.ChainManager().GetBlock(ethutil.Hex2Bytes(hash))
+ block = self.eth.ChainManager().GetBlock(common.Hex2Bytes(hash))
}
if block == nil {
diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go
index a49e9f6f8..476b441c8 100644
--- a/cmd/mist/gui.go
+++ b/cmd/mist/gui.go
@@ -37,7 +37,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethdb"
- "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/ui/qt/qwhisper"
"github.com/ethereum/go-ethereum/xeth"
@@ -93,7 +93,7 @@ func NewWindow(ethereum *eth.Ethereum) *Gui {
plugins: make(map[string]plugin),
serviceEvents: make(chan ServEv, 1),
}
- data, _ := ethutil.ReadAllFile(path.Join(ethereum.DataDir, "plugins.json"))
+ data, _ := common.ReadAllFile(path.Join(ethereum.DataDir, "plugins.json"))
json.Unmarshal([]byte(data), &gui.plugins)
return gui
@@ -200,7 +200,7 @@ func (gui *Gui) loadAddressBook() {
it := nameReg.Trie().Iterator()
for it.Next() {
if it.Key[0] != 0 {
- view.Call("addAddress", struct{ Name, Address string }{string(it.Key), ethutil.Bytes2Hex(it.Value)})
+ view.Call("addAddress", struct{ Name, Address string }{string(it.Key), common.Bytes2Hex(it.Value)})
}
}
@@ -221,7 +221,7 @@ func (self *Gui) loadMergedMiningOptions() {
Checked bool
Name, Address string
Id, ItemId int
- }{false, string(it.Key), ethutil.Bytes2Hex(it.Value), 0, i})
+ }{false, string(it.Key), common.Bytes2Hex(it.Value), 0, i})
i++
@@ -240,8 +240,8 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) {
var (
ptx = xeth.NewTx(tx)
- send = ethutil.Bytes2Hex(tx.From())
- rec = ethutil.Bytes2Hex(tx.To())
+ send = common.Bytes2Hex(tx.From())
+ rec = common.Bytes2Hex(tx.To())
)
ptx.Sender = send
ptx.Address = rec
@@ -265,7 +265,7 @@ func (gui *Gui) readPreviousTransactions() {
}
func (gui *Gui) processBlock(block *types.Block, initial bool) {
- name := ethutil.Bytes2Hex(block.Coinbase())
+ name := common.Bytes2Hex(block.Coinbase())
b := xeth.NewBlock(block)
b.Name = name
@@ -279,10 +279,10 @@ func (gui *Gui) setWalletValue(amount, unconfirmedFunds *big.Int) {
if unconfirmedFunds.Cmp(big.NewInt(0)) < 0 {
pos = "-"
}
- val := ethutil.CurrencyToString(new(big.Int).Abs(ethutil.BigCopy(unconfirmedFunds)))
- str = fmt.Sprintf("%v (%s %v)", ethutil.CurrencyToString(amount), pos, val)
+ val := common.CurrencyToString(new(big.Int).Abs(common.BigCopy(unconfirmedFunds)))
+ str = fmt.Sprintf("%v (%s %v)", common.CurrencyToString(amount), pos, val)
} else {
- str = fmt.Sprintf("%v", ethutil.CurrencyToString(amount))
+ str = fmt.Sprintf("%v", common.CurrencyToString(amount))
}
gui.win.Root().Call("setWalletValue", str)
diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go
index e4ea57b9b..195e81073 100644
--- a/cmd/mist/html_container.go
+++ b/cmd/mist/html_container.go
@@ -30,7 +30,7 @@ import (
"path/filepath"
"github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/xeth"
"github.com/howeyc/fsnotify"
"github.com/obscuren/qml"
@@ -62,7 +62,7 @@ func (app *HtmlApplication) Create() error {
return errors.New("Ethereum package not yet supported")
// TODO
- //ethutil.OpenPackage(app.path)
+ //common.OpenPackage(app.path)
}
win := component.CreateWindow(nil)
@@ -80,7 +80,7 @@ func (app *HtmlApplication) RootFolder() string {
if err != nil {
return ""
}
- return path.Dir(ethutil.WindonizePath(folder.RequestURI()))
+ return path.Dir(common.WindonizePath(folder.RequestURI()))
}
func (app *HtmlApplication) RecursiveFolders() []os.FileInfo {
files, _ := ioutil.ReadDir(app.RootFolder())
@@ -139,7 +139,7 @@ func (app *HtmlApplication) Window() *qml.Window {
}
func (app *HtmlApplication) NewBlock(block *types.Block) {
- b := &xeth.Block{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())}
+ b := &xeth.Block{Number: int(block.NumberU64()), Hash: common.Bytes2Hex(block.Hash())}
app.webView.Call("onNewBlockCb", b)
}
diff --git a/cmd/mist/main.go b/cmd/mist/main.go
index 4116783c9..256c08691 100644
--- a/cmd/mist/main.go
+++ b/cmd/mist/main.go
@@ -29,7 +29,7 @@ import (
"github.com/codegangsta/cli"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/eth"
- "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/ui/qt/webengine"
"github.com/obscuren/qml"
@@ -45,7 +45,7 @@ var (
assetPathFlag = cli.StringFlag{
Name: "asset_path",
Usage: "absolute path to GUI assets directory",
- Value: ethutil.DefaultAssetPath(),
+ Value: common.DefaultAssetPath(),
}
)
diff --git a/cmd/mist/qml_container.go b/cmd/mist/qml_container.go
index 16a055bc0..778ef0e40 100644
--- a/cmd/mist/qml_container.go
+++ b/cmd/mist/qml_container.go
@@ -25,7 +25,7 @@ import (
"runtime"
"github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/xeth"
"github.com/obscuren/qml"
)
@@ -68,7 +68,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) {
// Events
func (app *QmlApplication) NewBlock(block *types.Block) {
- pblock := &xeth.Block{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())}
+ pblock := &xeth.Block{Number: int(block.NumberU64()), Hash: common.Bytes2Hex(block.Hash())}
app.win.Call("onNewBlockCb", pblock)
}
diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go
index cc213b49a..b33b81267 100644
--- a/cmd/mist/ui_lib.go
+++ b/cmd/mist/ui_lib.go
@@ -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