Reimplemented message filters for rpc calls

This commit is contained in:
obscuren
2015-01-29 16:52:00 +01:00
parent ddf17d93ac
commit 6488a392a3
6 changed files with 207 additions and 16 deletions

View File

@ -1,6 +1,7 @@
package rpc
import "encoding/json"
import "github.com/ethereum/go-ethereum/core"
type GetBlockArgs struct {
BlockNumber int32
@ -36,10 +37,6 @@ type NewTxArgs struct {
Data string `json:"data"`
}
// type TxResponse struct {
// Hash string
// }
func (a *NewTxArgs) requirements() error {
if a.Gas == "" {
return NewErrorResponse("Transact requires a 'gas' value as argument")
@ -195,3 +192,29 @@ func (obj *Sha3Args) UnmarshalJSON(b []byte) (err error) {
}
return
}
type FilterOptions struct {
Earliest int64
Latest int64
Address string
Topics []string
Skip int
Max int
}
func toFilterOptions(options *FilterOptions) core.FilterOptions {
var opts core.FilterOptions
opts.Earliest = options.Earliest
opts.Latest = options.Latest
opts.Address = fromHex(options.Address)
opts.Topics = make([][]byte, len(options.Topics))
for i, topic := range options.Topics {
opts.Topics[i] = fromHex(topic)
}
return opts
}
type FilterChangedArgs struct {
n int
}