aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/responses.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-20 23:02:01 +0800
committerobscuren <geffobscura@gmail.com>2015-03-20 23:02:01 +0800
commita59bb053f4d2a4a28341c645c051c4c323581a1b (patch)
tree6f414de5c01c9cc69d2ee461ca49ef1858aa1ca6 /rpc/responses.go
parentdeee9cb170ff105992ede83c52013d0c2c4ad10d (diff)
parent28e1971272d5bab6aa683d3bbe711226ca1fef98 (diff)
downloadgo-tangerine-a59bb053f4d2a4a28341c645c051c4c323581a1b.tar
go-tangerine-a59bb053f4d2a4a28341c645c051c4c323581a1b.tar.gz
go-tangerine-a59bb053f4d2a4a28341c645c051c4c323581a1b.tar.bz2
go-tangerine-a59bb053f4d2a4a28341c645c051c4c323581a1b.tar.lz
go-tangerine-a59bb053f4d2a4a28341c645c051c4c323581a1b.tar.xz
go-tangerine-a59bb053f4d2a4a28341c645c051c4c323581a1b.tar.zst
go-tangerine-a59bb053f4d2a4a28341c645c051c4c323581a1b.zip
merge
Diffstat (limited to 'rpc/responses.go')
-rw-r--r--rpc/responses.go26
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
+}