Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds missing fields in getTransactionReceipt rpc response. #8

Merged
merged 1 commit into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 35 additions & 8 deletions ethereum/geth/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,22 @@ func (l *Log) Topics() []string {
}

type TransactionReceipt struct {
TTransactionHash string `json:"transactionHash"`
TTransactionIndex string `json:"transactionIndex"`
TBlockHash string `json:"blockHash"`
TBlockNumber string `json:"blockNumber"`
TTransactionHash string `json:"transactionHash"`
TTransactionIndex hexutil.Big `json:"transactionIndex"`
TBlockHash common.Hash `json:"blockHash"`
TBlockNumber hexutil.Big `json:"blockNumber"`

TFrom common.Address `json:"from"`
TTo *common.Address `json:"to"`

TGasUsed *hexutil.Big `json:"gasUsed"`
TCumulativeGasUsed *hexutil.Big `json:"cumulativeGasUsed"`
TContractAddress *common.Address `json:"contractAddress"`

TStatus string `json:"status"` // Can be null, if null do a check anyways. 0x0 fail, 0x1 success
TLogs []*Log `json:"logs"`
TLogsBloom string `json:"logsBloom"`
TRoot *string `json:"root"`
TStatus string `json:"status"` // Can be null, if null do a check anyways. 0x0 fail, 0x1 success
TLogs []*Log `json:"logs"`
TLogsBloom hexutil.Bytes `json:"logsBloom"`
TRoot *string `json:"root"`
}

func (t *TransactionReceipt) SetStatus(trace string) {
Expand All @@ -116,6 +119,26 @@ func (t *TransactionReceipt) Hash() string {
return t.TTransactionHash
}

func (t *TransactionReceipt) TransactionIndex() hexutil.Big {
return t.TTransactionIndex
}

func (t *TransactionReceipt) BlockHash() common.Hash {
return t.TBlockHash
}

func (t *TransactionReceipt) BlockNumber() hexutil.Big {
return t.TBlockNumber
}

func (t *TransactionReceipt) From() common.Address {
return t.TFrom
}

func (t *TransactionReceipt) To() *common.Address {
return t.TTo
}

func (t *TransactionReceipt) GasUsed() *hexutil.Big {
return t.TGasUsed
}
Expand All @@ -142,6 +165,10 @@ func (t *TransactionReceipt) Logs() []ethereum.Log {
return logs
}

func (t *TransactionReceipt) LogsBloom() hexutil.Bytes {
return t.TLogsBloom
}

// States Types

type EvmState struct {
Expand Down
43 changes: 35 additions & 8 deletions ethereum/parity/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,22 @@ func (l *Log) Topics() []string {
}

type TransactionReceipt struct {
TTransactionHash string `json:"transactionHash"`
TTransactionIndex string `json:"transactionIndex"`
TBlockHash string `json:"blockHash"`
TBlockNumber string `json:"blockNumber"`
TTransactionHash string `json:"transactionHash"`
TTransactionIndex hexutil.Big `json:"transactionIndex"`
TBlockHash common.Hash `json:"blockHash"`
TBlockNumber hexutil.Big `json:"blockNumber"`

TFrom common.Address `json:"from"`
TTo *common.Address `json:"to"`

TGasUsed *hexutil.Big `json:"gasUsed"`
TCumulativeGasUsed *hexutil.Big `json:"cumulativeGasUsed"`
TContractAddress *common.Address `json:"contractAddress"`

TStatus string `json:"status"` // Can be null, if null do a check anyways. 0x0 fail, 0x1 success
TLogs []*Log `json:"logs"`
TLogsBloom string `json:"logsBloom"`
TRoot *string `json:"root"`
TStatus string `json:"status"` // Can be null, if null do a check anyways. 0x0 fail, 0x1 success
TLogs []*Log `json:"logs"`
TLogsBloom hexutil.Bytes `json:"logsBloom"`
TRoot *string `json:"root"`
}

func (t *TransactionReceipt) SetStatus(trace string) {
Expand All @@ -120,6 +123,26 @@ func (t *TransactionReceipt) Hash() string {
return t.TTransactionHash
}

func (t *TransactionReceipt) TransactionIndex() hexutil.Big {
return t.TTransactionIndex
}

func (t *TransactionReceipt) BlockHash() common.Hash {
return t.TBlockHash
}

func (t *TransactionReceipt) BlockNumber() hexutil.Big {
return t.TBlockNumber
}

func (t *TransactionReceipt) From() common.Address {
return t.TFrom
}

func (t *TransactionReceipt) To() *common.Address {
return t.TTo
}

func (t *TransactionReceipt) GasUsed() *hexutil.Big {
return t.TGasUsed
}
Expand All @@ -146,6 +169,10 @@ func (t *TransactionReceipt) Logs() []ethereum.Log {
return logs
}

func (t *TransactionReceipt) LogsBloom() hexutil.Bytes {
return t.TLogsBloom
}

type Version struct {
Major int `json:"major"`
Minor int `json:"minor"`
Expand Down
8 changes: 8 additions & 0 deletions ethereum/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ type Log interface {

type TransactionReceipt interface {
Hash() string
TransactionIndex() hexutil.Big

BlockHash() common.Hash
BlockNumber() hexutil.Big

From() common.Address
To() *common.Address

GasUsed() *hexutil.Big
CumulativeGasUsed() *hexutil.Big
Expand All @@ -76,6 +83,7 @@ type TransactionReceipt interface {
Status() string
SetStatus(trace string)
Logs() []Log
LogsBloom() hexutil.Bytes
}

// States Types
Expand Down