Exemplo n.º 1
0
func (self *HtmlApplication) Messages(messages ethstate.Messages, id string) {
	var msgs []javascript.JSMessage
	for _, m := range messages {
		msgs = append(msgs, javascript.NewJSMessage(m))
	}

	b, _ := json.Marshal(msgs)

	self.webView.Call("onWatchedCb", string(b), id)
}
Exemplo n.º 2
0
func (self *ExtApplication) GetMessages(object map[string]interface{}) string {
	filter := ethchain.NewFilterFromMap(object, self.eth)

	messages := filter.Find()
	var msgs []javascript.JSMessage
	for _, m := range messages {
		msgs = append(msgs, javascript.NewJSMessage(m))
	}

	b, err := json.Marshal(msgs)
	if err != nil {
		return "{\"error\":" + err.Error() + "}"
	}

	return string(b)
}