mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
Gen code
This commit is contained in:
parent
5c8f66ebb4
commit
ce4bf5618e
2 changed files with 26 additions and 19 deletions
|
|
@ -16,21 +16,22 @@ var _ = (*receiptMarshaling)(nil)
|
||||||
// MarshalJSON marshals as JSON.
|
// MarshalJSON marshals as JSON.
|
||||||
func (r Receipt) MarshalJSON() ([]byte, error) {
|
func (r Receipt) MarshalJSON() ([]byte, error) {
|
||||||
type Receipt struct {
|
type Receipt struct {
|
||||||
Type hexutil.Uint64 `json:"type,omitempty"`
|
Type hexutil.Uint64 `json:"type,omitempty"`
|
||||||
PostState hexutil.Bytes `json:"root"`
|
PostState hexutil.Bytes `json:"root"`
|
||||||
Status hexutil.Uint64 `json:"status"`
|
Status hexutil.Uint64 `json:"status"`
|
||||||
CumulativeGasUsed hexutil.Uint64 `json:"cumulativeGasUsed" gencodec:"required"`
|
CumulativeGasUsed hexutil.Uint64 `json:"cumulativeGasUsed" gencodec:"required"`
|
||||||
Bloom Bloom `json:"logsBloom" gencodec:"required"`
|
Bloom Bloom `json:"logsBloom" gencodec:"required"`
|
||||||
Logs []*Log `json:"logs" gencodec:"required"`
|
Logs []*Log `json:"logs" gencodec:"required"`
|
||||||
TxHash common.Hash `json:"transactionHash" gencodec:"required"`
|
TxHash common.Hash `json:"transactionHash" gencodec:"required"`
|
||||||
ContractAddress common.Address `json:"contractAddress"`
|
ContractAddress common.Address `json:"contractAddress"`
|
||||||
GasUsed hexutil.Uint64 `json:"gasUsed" gencodec:"required"`
|
GasUsed hexutil.Uint64 `json:"gasUsed" gencodec:"required"`
|
||||||
EffectiveGasPrice *hexutil.Big `json:"effectiveGasPrice"`
|
EffectiveGasPrice *hexutil.Big `json:"effectiveGasPrice"`
|
||||||
BlobGasUsed hexutil.Uint64 `json:"blobGasUsed,omitempty"`
|
BlobGasUsed hexutil.Uint64 `json:"blobGasUsed,omitempty"`
|
||||||
BlobGasPrice *hexutil.Big `json:"blobGasPrice,omitempty"`
|
BlobGasPrice *hexutil.Big `json:"blobGasPrice,omitempty"`
|
||||||
BlockHash common.Hash `json:"blockHash,omitempty"`
|
BlockHash common.Hash `json:"blockHash,omitempty"`
|
||||||
BlockNumber *hexutil.Big `json:"blockNumber,omitempty"`
|
BlockNumber *hexutil.Big `json:"blockNumber,omitempty"`
|
||||||
TransactionIndex hexutil.Uint `json:"transactionIndex"`
|
TransactionIndex hexutil.Uint `json:"transactionIndex"`
|
||||||
|
To *common.Address `json:"to"`
|
||||||
}
|
}
|
||||||
var enc Receipt
|
var enc Receipt
|
||||||
enc.Type = hexutil.Uint64(r.Type)
|
enc.Type = hexutil.Uint64(r.Type)
|
||||||
|
|
@ -48,6 +49,7 @@ func (r Receipt) MarshalJSON() ([]byte, error) {
|
||||||
enc.BlockHash = r.BlockHash
|
enc.BlockHash = r.BlockHash
|
||||||
enc.BlockNumber = (*hexutil.Big)(r.BlockNumber)
|
enc.BlockNumber = (*hexutil.Big)(r.BlockNumber)
|
||||||
enc.TransactionIndex = hexutil.Uint(r.TransactionIndex)
|
enc.TransactionIndex = hexutil.Uint(r.TransactionIndex)
|
||||||
|
enc.To = r.To
|
||||||
return json.Marshal(&enc)
|
return json.Marshal(&enc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,6 +71,7 @@ func (r *Receipt) UnmarshalJSON(input []byte) error {
|
||||||
BlockHash *common.Hash `json:"blockHash,omitempty"`
|
BlockHash *common.Hash `json:"blockHash,omitempty"`
|
||||||
BlockNumber *hexutil.Big `json:"blockNumber,omitempty"`
|
BlockNumber *hexutil.Big `json:"blockNumber,omitempty"`
|
||||||
TransactionIndex *hexutil.Uint `json:"transactionIndex"`
|
TransactionIndex *hexutil.Uint `json:"transactionIndex"`
|
||||||
|
To *common.Address `json:"to"`
|
||||||
}
|
}
|
||||||
var dec Receipt
|
var dec Receipt
|
||||||
if err := json.Unmarshal(input, &dec); err != nil {
|
if err := json.Unmarshal(input, &dec); err != nil {
|
||||||
|
|
@ -124,5 +127,8 @@ func (r *Receipt) UnmarshalJSON(input []byte) error {
|
||||||
if dec.TransactionIndex != nil {
|
if dec.TransactionIndex != nil {
|
||||||
r.TransactionIndex = uint(*dec.TransactionIndex)
|
r.TransactionIndex = uint(*dec.TransactionIndex)
|
||||||
}
|
}
|
||||||
|
if dec.To != nil {
|
||||||
|
r.To = dec.To
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,10 +68,10 @@ type Receipt struct {
|
||||||
|
|
||||||
// Inclusion information: These fields provide information about the inclusion of the
|
// Inclusion information: These fields provide information about the inclusion of the
|
||||||
// transaction corresponding to this receipt.
|
// transaction corresponding to this receipt.
|
||||||
BlockHash common.Hash `json:"blockHash,omitempty"`
|
BlockHash common.Hash `json:"blockHash,omitempty"`
|
||||||
BlockNumber *big.Int `json:"blockNumber,omitempty"`
|
BlockNumber *big.Int `json:"blockNumber,omitempty"`
|
||||||
TransactionIndex uint `json:"transactionIndex"`
|
TransactionIndex uint `json:"transactionIndex"`
|
||||||
To common.Address `json:"to,omitempty"`
|
To *common.Address `json:"to"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type receiptMarshaling struct {
|
type receiptMarshaling struct {
|
||||||
|
|
@ -85,6 +85,7 @@ type receiptMarshaling struct {
|
||||||
BlobGasPrice *hexutil.Big
|
BlobGasPrice *hexutil.Big
|
||||||
BlockNumber *hexutil.Big
|
BlockNumber *hexutil.Big
|
||||||
TransactionIndex hexutil.Uint
|
TransactionIndex hexutil.Uint
|
||||||
|
To *common.Address
|
||||||
}
|
}
|
||||||
|
|
||||||
// receiptRLP is the consensus encoding of a receipt.
|
// receiptRLP is the consensus encoding of a receipt.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue