blob: 6583a8ec0b3fbd044f595a0dab40291e08a78b19 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package types
import (
"encoding/json"
"errors"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
)
func (r Receipt) MarshalJSON() ([]byte, error) {
type ReceiptJSON struct {
PostState hexutil.Bytes `json:"root"`
CumulativeGasUsed *hexutil.Big `json:"cumulativeGasUsed"`
Bloom Bloom `json:"logsBloom"`
Logs []*Log `json:"logs"`
TxHash common.Hash `json:"transactionHash"`
ContractAddress common.Address `json:"contractAddress" optional:"true"`
GasUsed *hexutil.Big `json:"gasUsed"`
}
var enc ReceiptJSON
enc.PostState = r.PostState
enc.CumulativeGasUsed = (*hexutil.Big)(r.CumulativeGasUsed)
enc.Bloom = r.Bloom
enc.Logs = r.Logs
enc.TxHash = r.TxHash
enc.ContractAddress = r.ContractAddress
enc.GasUsed = (*hexutil.Big)(r.GasUsed)
return json.Marshal(&enc)
}
func (r *Receipt) UnmarshalJSON(input []byte) error {
type ReceiptJSON struct {
PostState hexutil.Bytes `json:"root"`
CumulativeGasUsed *hexutil.Big `json:"cumulativeGasUsed"`
Bloom *Bloom `json:"logsBloom"`
Logs []*Log `json:"logs"`
TxHash *common.Hash `json:"transactionHash"`
ContractAddress *common.Address `json:"contractAddress" optional:"true"`
GasUsed *hexutil.Big `json:"gasUsed"`
}
var dec ReceiptJSON
if err := json.Unmarshal(input, &dec); err != nil {
return err
}
var x Receipt
if dec.PostState == nil {
return errors.New("missing required field 'root' for Receipt")
}
x.PostState = dec.PostState
if dec.CumulativeGasUsed == nil {
return errors.New("missing required field 'cumulativeGasUsed' for Receipt")
}
x.CumulativeGasUsed = (*big.Int)(dec.CumulativeGasUsed)
if dec.Bloom == nil {
return errors.New("missing required field 'logsBloom' for Receipt")
}
x.Bloom = *dec.Bloom
if dec.Logs == nil {
return errors.New("missing required field 'logs' for Receipt")
}
x.Logs = dec.Logs
if dec.TxHash == nil {
return errors.New("missing required field 'transactionHash' for Receipt")
}
x.TxHash = *dec.TxHash
if dec.ContractAddress != nil {
x.ContractAddress = *dec.ContractAddress
}
if dec.GasUsed == nil {
return errors.New("missing required field 'gasUsed' for Receipt")
}
x.GasUsed = (*big.Int)(dec.GasUsed)
*r = x
return nil
}
|