Example #1
0
func NewJSFilterFromMap(object map[string]interface{}, eth ethchain.EthManager) *JSFilter {
	filter := &JSFilter{eth, ethchain.NewFilterFromMap(object, eth), make(chan bool), nil, nil}

	go filter.mainLoop()

	return filter
}
Example #2
0
func (self *JSEthereum) Messages(object map[string]interface{}) otto.Value {
	filter := ethchain.NewFilterFromMap(object, self.ethereum)

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

	v, _ := self.vm.ToValue(msgs)

	return v
}
Example #3
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)
}
Example #4
0
func (self *ExtApplication) Watch(filterOptions map[string]interface{}, identifier string) {
	self.filters[identifier] = ethchain.NewFilterFromMap(filterOptions, self.eth)
}