|
|
@ -38,31 +38,19 @@ func (self *JSBlock) GetTransaction(hash string) otto.Value { |
|
|
|
return self.eth.toVal(self.JSBlock.GetTransaction(hash)) |
|
|
|
return self.eth.toVal(self.JSBlock.GetTransaction(hash)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type JSMessage struct { |
|
|
|
type JSLog struct { |
|
|
|
To string `json:"to"` |
|
|
|
Address string `json:address` |
|
|
|
From string `json:"from"` |
|
|
|
Topics []string `json:topics` |
|
|
|
Input string `json:"input"` |
|
|
|
Number int32 `json:number` |
|
|
|
Output string `json:"output"` |
|
|
|
Data string `json:data` |
|
|
|
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 *state.Message) JSMessage { |
|
|
|
func NewJSLog(log state.Log) JSLog { |
|
|
|
return JSMessage{ |
|
|
|
return JSLog{ |
|
|
|
To: ethutil.Bytes2Hex(message.To), |
|
|
|
Address: ethutil.Bytes2Hex(log.Address()), |
|
|
|
From: ethutil.Bytes2Hex(message.From), |
|
|
|
Topics: nil, //ethutil.Bytes2Hex(log.Address()),
|
|
|
|
Input: ethutil.Bytes2Hex(message.Input), |
|
|
|
Number: 0, |
|
|
|
Output: ethutil.Bytes2Hex(message.Output), |
|
|
|
Data: ethutil.Bytes2Hex(log.Data()), |
|
|
|
Path: message.Path, |
|
|
|
|
|
|
|
Origin: ethutil.Bytes2Hex(message.Origin), |
|
|
|
|
|
|
|
Timestamp: int32(message.Timestamp), |
|
|
|
|
|
|
|
Coinbase: ethutil.Bytes2Hex(message.Origin), |
|
|
|
|
|
|
|
Block: ethutil.Bytes2Hex(message.Block), |
|
|
|
|
|
|
|
Number: int32(message.Number.Int64()), |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -120,13 +108,13 @@ func (self *JSEthereum) toVal(v interface{}) otto.Value { |
|
|
|
func (self *JSEthereum) Messages(object map[string]interface{}) otto.Value { |
|
|
|
func (self *JSEthereum) Messages(object map[string]interface{}) otto.Value { |
|
|
|
filter := ui.NewFilterFromMap(object, self.ethereum) |
|
|
|
filter := ui.NewFilterFromMap(object, self.ethereum) |
|
|
|
|
|
|
|
|
|
|
|
messages := filter.Find() |
|
|
|
logs := filter.Find() |
|
|
|
var msgs []JSMessage |
|
|
|
var jslogs []JSLog |
|
|
|
for _, m := range messages { |
|
|
|
for _, m := range logs { |
|
|
|
msgs = append(msgs, NewJSMessage(m)) |
|
|
|
jslogs = append(jslogs, NewJSLog(m)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
v, _ := self.vm.ToValue(msgs) |
|
|
|
v, _ := self.vm.ToValue(jslogs) |
|
|
|
|
|
|
|
|
|
|
|
return v |
|
|
|
return v |
|
|
|
} |
|
|
|
} |
|
|
|