aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/mist
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-03-16 23:46:29 +0800
committerzelig <viktor.tron@gmail.com>2015-03-16 23:46:29 +0800
commit5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb (patch)
treed5ba6197a8c0c8e36bb92ee9fc8aad717cb2d178 /cmd/mist
parent8393dab470c40678caf36ada82e312d29c4cf5c4 (diff)
parent22893b7ac925c49168c119f293ea8befc3aff5cc (diff)
downloaddexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar
dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.gz
dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.bz2
dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.lz
dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.xz
dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.zst
dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.zip
Merge remote-tracking branch 'upstream/develop' into frontier/js
Conflicts: cmd/ethereum/js.go javascript/types.go
Diffstat (limited to 'cmd/mist')
-rw-r--r--cmd/mist/bindings.go21
-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.go31
6 files changed, 35 insertions, 53 deletions
diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go
index b56c0dddf..5d08e7dd7 100644
--- a/cmd/mist/bindings.go
+++ b/cmd/mist/bindings.go
@@ -26,8 +26,8 @@ import (
"strconv"
"github.com/ethereum/go-ethereum/cmd/utils"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
)
@@ -37,32 +37,23 @@ 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)
- if err != nil {
- return "", err
- }
- data = ethutil.Bytes2Hex(code)
- } else {
- data = ethutil.Bytes2Hex(utils.FormatTransactionData(d))
- }
+ d = common.Bytes2Hex(utils.FormatTransactionData(d))
- return gui.xeth.Transact(from, recipient, value, gas, gasPrice, data)
+ return gui.xeth.Transact(from, recipient, value, gas, gasPrice, d)
}
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 +67,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 e50dfad14..19ad09454 100644
--- a/cmd/mist/gui.go
+++ b/cmd/mist/gui.go
@@ -35,7 +35,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"
@@ -91,7 +91,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
@@ -198,7 +198,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)})
}
}
@@ -219,7 +219,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++
@@ -238,8 +238,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
@@ -263,7 +263,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
@@ -277,10 +277,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 887eda59e..1c51233e3 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 42cdcb9d7..34ce56e77 100644
--- a/cmd/mist/ui_lib.go
+++ b/cmd/mist/ui_lib.go
@@ -24,9 +24,9 @@ import (
"io/ioutil"
"path"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
- "github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/xeth"
"github.com/obscuren/qml"
@@ -71,7 +71,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)
@@ -126,15 +126,6 @@ func (self *UiLib) Transact(params map[string]interface{}) (string, error) {
)
}
-func (self *UiLib) Compile(code string) (string, error) {
- bcode, err := ethutil.Compile(code, false)
- if err != nil {
- return err.Error(), err
- }
-
- return ethutil.Bytes2Hex(bcode), err
-}
-
func (self *UiLib) Call(params map[string]interface{}) (string, error) {
object := mapToTxParams(params)
@@ -152,8 +143,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,
@@ -176,7 +167,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 {
@@ -184,7 +175,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
@@ -212,7 +203,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 {
@@ -222,7 +213,7 @@ func (self *UiLib) Messages(id int) *ethutil.List {
}
*/
- return ethutil.EmptyList()
+ return common.EmptyList()
}
func (self *UiLib) ReadFile(p string) string {
@@ -264,14 +255,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