mirror of https://github.com/status-im/op-geth.git
Concat and pad data
This commit is contained in:
parent
60b1f9629c
commit
e32f7baa0d
|
@ -59,7 +59,8 @@ Rectangle {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
webview.url = "http://etherian.io"
|
||||
//webview.url = "http://etherian.io"
|
||||
webview.url = "file:///Users/jeffrey/test.html"
|
||||
}
|
||||
|
||||
signal messages(var messages, int id);
|
||||
|
@ -350,7 +351,7 @@ Rectangle {
|
|||
for(var i = 0; i < fields.length; i++) {
|
||||
params[fields[i]] = params[fields[i]] || "";
|
||||
}
|
||||
if(typeof params.payload === "object") { params.payload = params.payload.join(""); }
|
||||
if(typeof params.payload !== "object") { params.payload = [params.payload]; } //params.payload = params.payload.join(""); }
|
||||
params.topics = params.topics || [];
|
||||
params.priority = params.priority || 1000;
|
||||
params.ttl = params.ttl || 100;
|
||||
|
|
|
@ -52,7 +52,7 @@ Rectangle {
|
|||
Button {
|
||||
text: "Send"
|
||||
onClicked: {
|
||||
shh.post(eth.toHex(data.text), "", identity, topics.text.split(","), 500, 50)
|
||||
shh.post([eth.toHex(data.text)], "", identity, topics.text.split(","), 500, 50)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,8 +33,13 @@ func (self *Whisper) SetView(view qml.Object) {
|
|||
self.view = view
|
||||
}
|
||||
|
||||
func (self *Whisper) Post(data, to, from string, topics []string, priority, ttl uint32) {
|
||||
msg := whisper.NewMessage(fromHex(data))
|
||||
func (self *Whisper) Post(payload []string, to, from string, topics []string, priority, ttl uint32) {
|
||||
var data []byte
|
||||
for _, d := range payload {
|
||||
data = append(data, fromHex(d)...)
|
||||
}
|
||||
|
||||
msg := whisper.NewMessage(data)
|
||||
envelope, err := msg.Seal(time.Duration(priority*100000), whisper.Opts{
|
||||
Ttl: time.Duration(ttl),
|
||||
To: crypto.ToECDSAPub(fromHex(to)),
|
||||
|
|
Loading…
Reference in New Issue