aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/responses.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-20 08:52:36 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-20 08:52:36 +0800
commit12d87226a74d3c4095ea8e189c30ff31fcadf59f (patch)
tree3b4b3bb6dd381aeb4e0a25ad5ed891d5b6cf00f0 /rpc/responses.go
parent14a2f42f3700640f191e0095b50a266d2a919b38 (diff)
parentabc3d8d50a8691d9b4c2bd047807908d157e223c (diff)
downloadgo-tangerine-12d87226a74d3c4095ea8e189c30ff31fcadf59f.tar
go-tangerine-12d87226a74d3c4095ea8e189c30ff31fcadf59f.tar.gz
go-tangerine-12d87226a74d3c4095ea8e189c30ff31fcadf59f.tar.bz2
go-tangerine-12d87226a74d3c4095ea8e189c30ff31fcadf59f.tar.lz
go-tangerine-12d87226a74d3c4095ea8e189c30ff31fcadf59f.tar.xz
go-tangerine-12d87226a74d3c4095ea8e189c30ff31fcadf59f.tar.zst
go-tangerine-12d87226a74d3c4095ea8e189c30ff31fcadf59f.zip
Merge branch 'rpcutil' into rpcfrontier
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 eec483fb7..a3613f380 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 {
@@ -211,3 +212,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 = common.ToHex(log.Address())
+ l.Data = common.ToHex(log.Data())
+ l.Number = log.Number()
+ for j, topic := range log.Topics() {
+ l.Topic[j] = common.ToHex(topic)
+ }
+ ls[i] = l
+ }
+
+ return
+}