diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-20 23:02:01 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-20 23:02:01 +0800 |
commit | a59bb053f4d2a4a28341c645c051c4c323581a1b (patch) | |
tree | 6f414de5c01c9cc69d2ee461ca49ef1858aa1ca6 /rpc/responses.go | |
parent | deee9cb170ff105992ede83c52013d0c2c4ad10d (diff) | |
parent | 28e1971272d5bab6aa683d3bbe711226ca1fef98 (diff) | |
download | dexon-a59bb053f4d2a4a28341c645c051c4c323581a1b.tar dexon-a59bb053f4d2a4a28341c645c051c4c323581a1b.tar.gz dexon-a59bb053f4d2a4a28341c645c051c4c323581a1b.tar.bz2 dexon-a59bb053f4d2a4a28341c645c051c4c323581a1b.tar.lz dexon-a59bb053f4d2a4a28341c645c051c4c323581a1b.tar.xz dexon-a59bb053f4d2a4a28341c645c051c4c323581a1b.tar.zst dexon-a59bb053f4d2a4a28341c645c051c4c323581a1b.zip |
merge
Diffstat (limited to 'rpc/responses.go')
-rw-r--r-- | rpc/responses.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/rpc/responses.go b/rpc/responses.go index 5e197b729..ce64f1581 100644 --- a/rpc/responses.go +++ b/rpc/responses.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/state" ) type BlockRes struct { @@ -215,3 +216,28 @@ type FilterWhisperRes struct { Payload string `json:"payload"` WorkProved string `json:"workProved"` } + +type LogRes struct { + Address string `json:"address"` + Topic []string `json:"topic"` + Data string `json:"data"` + Number uint64 `json:"number"` +} + +func NewLogsRes(logs state.Logs) (ls []LogRes) { + ls = make([]LogRes, len(logs)) + + for i, log := range logs { + var l LogRes + l.Topic = make([]string, len(log.Topics())) + l.Address = log.Address().Hex() + l.Data = common.ToHex(log.Data()) + l.Number = log.Number() + for j, topic := range log.Topics() { + l.Topic[j] = topic.Hex() + } + ls[i] = l + } + + return +} |