|
|
|
@ -12,10 +12,11 @@ import ( |
|
|
|
|
|
|
|
|
|
var _ = (*receiptMarshaling)(nil) |
|
|
|
|
|
|
|
|
|
// MarshalJSON marshals as JSON.
|
|
|
|
|
func (r Receipt) MarshalJSON() ([]byte, error) { |
|
|
|
|
type Receipt struct { |
|
|
|
|
PostState hexutil.Bytes `json:"root"` |
|
|
|
|
Status hexutil.Uint `json:"status"` |
|
|
|
|
Status hexutil.Uint64 `json:"status"` |
|
|
|
|
CumulativeGasUsed hexutil.Uint64 `json:"cumulativeGasUsed" gencodec:"required"` |
|
|
|
|
Bloom Bloom `json:"logsBloom" gencodec:"required"` |
|
|
|
|
Logs []*Log `json:"logs" gencodec:"required"` |
|
|
|
@ -25,7 +26,7 @@ func (r Receipt) MarshalJSON() ([]byte, error) { |
|
|
|
|
} |
|
|
|
|
var enc Receipt |
|
|
|
|
enc.PostState = r.PostState |
|
|
|
|
enc.Status = hexutil.Uint(r.Status) |
|
|
|
|
enc.Status = hexutil.Uint64(r.Status) |
|
|
|
|
enc.CumulativeGasUsed = hexutil.Uint64(r.CumulativeGasUsed) |
|
|
|
|
enc.Bloom = r.Bloom |
|
|
|
|
enc.Logs = r.Logs |
|
|
|
@ -35,10 +36,11 @@ func (r Receipt) MarshalJSON() ([]byte, error) { |
|
|
|
|
return json.Marshal(&enc) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// UnmarshalJSON unmarshals from JSON.
|
|
|
|
|
func (r *Receipt) UnmarshalJSON(input []byte) error { |
|
|
|
|
type Receipt struct { |
|
|
|
|
PostState *hexutil.Bytes `json:"root"` |
|
|
|
|
Status *hexutil.Uint `json:"status"` |
|
|
|
|
Status *hexutil.Uint64 `json:"status"` |
|
|
|
|
CumulativeGasUsed *hexutil.Uint64 `json:"cumulativeGasUsed" gencodec:"required"` |
|
|
|
|
Bloom *Bloom `json:"logsBloom" gencodec:"required"` |
|
|
|
|
Logs []*Log `json:"logs" gencodec:"required"` |
|
|
|
@ -54,7 +56,7 @@ func (r *Receipt) UnmarshalJSON(input []byte) error { |
|
|
|
|
r.PostState = *dec.PostState |
|
|
|
|
} |
|
|
|
|
if dec.Status != nil { |
|
|
|
|
r.Status = uint(*dec.Status) |
|
|
|
|
r.Status = uint64(*dec.Status) |
|
|
|
|
} |
|
|
|
|
if dec.CumulativeGasUsed == nil { |
|
|
|
|
return errors.New("missing required field 'cumulativeGasUsed' for Receipt") |
|
|
|
|