diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-16 18:27:38 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-16 18:27:38 +0800 |
commit | b5234413611ce5984292f85a01de1f56c045b490 (patch) | |
tree | e6e0c6f7fe8358a2dc63cdea11ac66b4f59397f5 /ui | |
parent | 0b8f66ed9ef177dc72442dd7ba337c6733e30344 (diff) | |
download | dexon-b5234413611ce5984292f85a01de1f56c045b490.tar dexon-b5234413611ce5984292f85a01de1f56c045b490.tar.gz dexon-b5234413611ce5984292f85a01de1f56c045b490.tar.bz2 dexon-b5234413611ce5984292f85a01de1f56c045b490.tar.lz dexon-b5234413611ce5984292f85a01de1f56c045b490.tar.xz dexon-b5234413611ce5984292f85a01de1f56c045b490.tar.zst dexon-b5234413611ce5984292f85a01de1f56c045b490.zip |
Moved ethutil => common
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/qwhisper/message.go | 6 | ||||
-rw-r--r-- | ui/qt/qwhisper/whisper.go | 20 |
2 files changed, 13 insertions, 13 deletions
diff --git a/ui/qt/qwhisper/message.go b/ui/qt/qwhisper/message.go index 26e72ac93..f8bed8a2d 100644 --- a/ui/qt/qwhisper/message.go +++ b/ui/qt/qwhisper/message.go @@ -2,7 +2,7 @@ package qwhisper import ( "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/whisper" ) @@ -17,7 +17,7 @@ func ToQMessage(msg *whisper.Message) *Message { return &Message{ ref: msg, Flags: int32(msg.Flags), - Payload: "0x" + ethutil.Bytes2Hex(msg.Payload), - From: "0x" + ethutil.Bytes2Hex(crypto.FromECDSAPub(msg.Recover())), + Payload: "0x" + common.Bytes2Hex(msg.Payload), + From: "0x" + common.Bytes2Hex(crypto.FromECDSAPub(msg.Recover())), } } diff --git a/ui/qt/qwhisper/whisper.go b/ui/qt/qwhisper/whisper.go index 7fef1929f..90ec822aa 100644 --- a/ui/qt/qwhisper/whisper.go +++ b/ui/qt/qwhisper/whisper.go @@ -5,7 +5,7 @@ import ( "time" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/whisper" "github.com/obscuren/qml" @@ -13,7 +13,7 @@ import ( var qlogger = logger.NewLogger("QSHH") -func toHex(b []byte) string { return "0x" + ethutil.Bytes2Hex(b) } +func toHex(b []byte) string { return "0x" + common.Bytes2Hex(b) } type Whisper struct { *whisper.Whisper @@ -33,15 +33,15 @@ func (self *Whisper) SetView(view qml.Object) { func (self *Whisper) Post(payload []string, to, from string, topics []string, priority, ttl uint32) { var data []byte for _, d := range payload { - data = append(data, ethutil.FromHex(d)...) + data = append(data, common.FromHex(d)...) } - pk := crypto.ToECDSAPub(ethutil.FromHex(from)) + pk := crypto.ToECDSAPub(common.FromHex(from)) if key := self.Whisper.GetIdentity(pk); key != nil { msg := whisper.NewMessage(data) envelope, err := msg.Seal(time.Duration(priority*100000), whisper.Opts{ Ttl: time.Duration(ttl) * time.Second, - To: crypto.ToECDSAPub(ethutil.FromHex(to)), + To: crypto.ToECDSAPub(common.FromHex(to)), From: key, Topics: whisper.TopicsFromString(topics...), }) @@ -70,7 +70,7 @@ func (self *Whisper) NewIdentity() string { } func (self *Whisper) HasIdentity(key string) bool { - return self.Whisper.HasIdentity(crypto.ToECDSAPub(ethutil.FromHex(key))) + return self.Whisper.HasIdentity(crypto.ToECDSAPub(common.FromHex(key))) } func (self *Whisper) Watch(opts map[string]interface{}, view *qml.Common) int { @@ -88,9 +88,9 @@ func (self *Whisper) Watch(opts map[string]interface{}, view *qml.Common) int { return i } -func (self *Whisper) Messages(id int) (messages *ethutil.List) { +func (self *Whisper) Messages(id int) (messages *common.List) { msgs := self.Whisper.Messages(id) - messages = ethutil.EmptyList() + messages = common.EmptyList() for _, message := range msgs { messages.Append(ToQMessage(message)) } @@ -100,10 +100,10 @@ func (self *Whisper) Messages(id int) (messages *ethutil.List) { func filterFromMap(opts map[string]interface{}) (f whisper.Filter) { if to, ok := opts["to"].(string); ok { - f.To = crypto.ToECDSAPub(ethutil.FromHex(to)) + f.To = crypto.ToECDSAPub(common.FromHex(to)) } if from, ok := opts["from"].(string); ok { - f.From = crypto.ToECDSAPub(ethutil.FromHex(from)) + f.From = crypto.ToECDSAPub(common.FromHex(from)) } if topicList, ok := opts["topics"].(*qml.List); ok { var topics []string |