Skip to content

Commit

Permalink
Fix structures
Browse files Browse the repository at this point in the history
  • Loading branch information
dkeysil committed Mar 15, 2024
1 parent 3967f4d commit 123146d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions domain/ethereum.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func (le LogEntry) ToTypesLog() (log types.Log) {
return
}

func LogsFromCombinedBlockEvent(bd *protocol.BlockData) []LogEntry {
func LogsFromBlockData(bd *protocol.BlockData) []LogEntry {
logs := make([]LogEntry, len(bd.Logs))
for i, log := range bd.Logs {
logs[i] = LogEntry{
Expand All @@ -260,13 +260,13 @@ func LogsFromCombinedBlockEvent(bd *protocol.BlockData) []LogEntry {
Data: &log.Data,
LogIndex: &log.LogIndex,
Removed: &log.Removed,
Topics: make([]*string, len(log.Topics)),
Topics: make([]*string, 0, len(log.Topics)),
TransactionHash: &log.TransactionHash,
TransactionIndex: &log.TransactionIndex,
}

for j, topic := range log.Topics {
logs[j].Topics = append(logs[j].Topics, &topic)
for _, topic := range log.Topics {
logs[i].Topics = append(logs[i].Topics, &topic)
}
}

Expand All @@ -291,11 +291,11 @@ type TransactionReceipt struct {

// TraceAction is an element of a trace_block Trace response
type TraceAction struct {
CallType *string `json:"callType"`
To *string `json:"to"`
Input *string `json:"input"`
From *string `json:"from"`
CallType *string `json:"callType"`
Gas *string `json:"gas"`
Input *string `json:"input"`
To *string `json:"to"`
Value *string `json:"value"`
Init *string `json:"init"`
Address *string `json:"address"`
Expand All @@ -305,8 +305,8 @@ type TraceAction struct {

// TraceResult is a result element of a trace_block Trace response
type TraceResult struct {
Output *string `json:"output"`
GasUsed *string `json:"gasUsed"`
Output *string `json:"output"`
Address *string `json:"address"`
Code *string `json:"code"`
}
Expand All @@ -316,13 +316,13 @@ type Trace struct {
Action TraceAction `json:"action"`
BlockHash *string `json:"blockHash"`
BlockNumber *int `json:"blockNumber"`
Error *string `json:"error"`
Result *TraceResult `json:"result"`
Subtraces int `json:"subtraces"`
TraceAddress []int `json:"traceAddress"`
TransactionHash *string `json:"transactionHash"`
TransactionPosition *int `json:"transactionPosition"`
Type string `json:"type"`
Error *string `json:"error"`
}

func (t Trace) ToProto() *protocol.TransactionEvent_Trace {
Expand Down Expand Up @@ -363,7 +363,7 @@ func (t Trace) ToProto() *protocol.TransactionEvent_Trace {
}
}

func TracesFromCombinedBlockEvent(bd *protocol.BlockData) ([]Trace, error) {
func TracesFromBlockData(bd *protocol.BlockData) ([]Trace, error) {
traces := make([]Trace, len(bd.Traces))
blockNumber, err := strconv.ParseInt(strings.Replace(bd.Block.Number, "0x", "", -1), 16, 64)
if err != nil {
Expand Down

0 comments on commit 123146d

Please sign in to comment.