diff options
author | obscuren <geffobscura@gmail.com> | 2014-08-14 23:01:21 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-08-14 23:01:21 +0800 |
commit | 612b631823c0cb80f0e559c533b32b6890349761 (patch) | |
tree | 64708b91556a204376fe2e9b3036faa6b4217de5 /javascript | |
parent | 3fd0337330ab4ceb25abfc7ec04b576e8f3f0914 (diff) | |
download | go-tangerine-612b631823c0cb80f0e559c533b32b6890349761.tar.gz go-tangerine-612b631823c0cb80f0e559c533b32b6890349761.tar.zst go-tangerine-612b631823c0cb80f0e559c533b32b6890349761.zip |
Json types
Diffstat (limited to 'javascript')
-rw-r--r-- | javascript/types.go | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/javascript/types.go b/javascript/types.go index f9d18b26a..fb1e54ae7 100644 --- a/javascript/types.go +++ b/javascript/types.go @@ -39,15 +39,16 @@ func (self *JSBlock) GetTransaction(hash string) otto.Value { } type JSMessage struct { - To, From string - Input string - Output string - Path int - Origin string - Timestamp int32 - Coinbase string - Block string - Number int32 + To string `json:"to"` + From string `json:"from"` + Input string `json:"input"` + Output string `json:"output"` + Path int `json:"path"` + Origin string `json:"origin"` + Timestamp int32 `json:"timestamp"` + Coinbase string `json:"coinbase"` + Block string `json:"block"` + Number int32 `json:"number"` } func NewJSMessage(message *ethstate.Message) JSMessage { @@ -137,6 +138,7 @@ func (self *JSEthereum) Messages(object map[string]interface{}) otto.Value { filter.SetEarliestBlock(earliest) } } + if object["latest"] != nil { latest := object["latest"] if l, ok := latest.(string); ok { @@ -146,10 +148,10 @@ func (self *JSEthereum) Messages(object map[string]interface{}) otto.Value { } } if object["to"] != nil { - filter.SetTo(ethutil.Hex2Bytes(object["to"].(string))) + filter.AddTo(ethutil.Hex2Bytes(object["to"].(string))) } if object["from"] != nil { - filter.SetFrom(ethutil.Hex2Bytes(object["from"].(string))) + filter.AddFrom(ethutil.Hex2Bytes(object["from"].(string))) } if object["max"] != nil { filter.SetMax(object["max"].(int)) |