mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 10:50:44 +00:00
Json types
This commit is contained in:
parent
3fd0337330
commit
612b631823
1 changed files with 13 additions and 11 deletions
|
|
@ -39,15 +39,16 @@ func (self *JSBlock) GetTransaction(hash string) otto.Value {
|
||||||
}
|
}
|
||||||
|
|
||||||
type JSMessage struct {
|
type JSMessage struct {
|
||||||
To, From string
|
To string `json:"to"`
|
||||||
Input string
|
From string `json:"from"`
|
||||||
Output string
|
Input string `json:"input"`
|
||||||
Path int
|
Output string `json:"output"`
|
||||||
Origin string
|
Path int `json:"path"`
|
||||||
Timestamp int32
|
Origin string `json:"origin"`
|
||||||
Coinbase string
|
Timestamp int32 `json:"timestamp"`
|
||||||
Block string
|
Coinbase string `json:"coinbase"`
|
||||||
Number int32
|
Block string `json:"block"`
|
||||||
|
Number int32 `json:"number"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewJSMessage(message *ethstate.Message) JSMessage {
|
func NewJSMessage(message *ethstate.Message) JSMessage {
|
||||||
|
|
@ -137,6 +138,7 @@ func (self *JSEthereum) Messages(object map[string]interface{}) otto.Value {
|
||||||
filter.SetEarliestBlock(earliest)
|
filter.SetEarliestBlock(earliest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if object["latest"] != nil {
|
if object["latest"] != nil {
|
||||||
latest := object["latest"]
|
latest := object["latest"]
|
||||||
if l, ok := latest.(string); ok {
|
if l, ok := latest.(string); ok {
|
||||||
|
|
@ -146,10 +148,10 @@ func (self *JSEthereum) Messages(object map[string]interface{}) otto.Value {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if object["to"] != nil {
|
if object["to"] != nil {
|
||||||
filter.SetTo(ethutil.Hex2Bytes(object["to"].(string)))
|
filter.AddTo(ethutil.Hex2Bytes(object["to"].(string)))
|
||||||
}
|
}
|
||||||
if object["from"] != nil {
|
if object["from"] != nil {
|
||||||
filter.SetFrom(ethutil.Hex2Bytes(object["from"].(string)))
|
filter.AddFrom(ethutil.Hex2Bytes(object["from"].(string)))
|
||||||
}
|
}
|
||||||
if object["max"] != nil {
|
if object["max"] != nil {
|
||||||
filter.SetMax(object["max"].(int))
|
filter.SetMax(object["max"].(int))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue