mirror of https://github.com/ethereum/go-ethereum
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.8 KiB
54 lines
1.8 KiB
4 years ago
|
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
||
|
|
||
3 years ago
|
package beacon
|
||
4 years ago
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"errors"
|
||
|
|
||
|
"github.com/ethereum/go-ethereum/common"
|
||
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||
|
)
|
||
|
|
||
3 years ago
|
var _ = (*payloadAttributesMarshaling)(nil)
|
||
4 years ago
|
|
||
|
// MarshalJSON marshals as JSON.
|
||
3 years ago
|
func (p PayloadAttributesV1) MarshalJSON() ([]byte, error) {
|
||
|
type PayloadAttributesV1 struct {
|
||
3 years ago
|
Timestamp hexutil.Uint64 `json:"timestamp" gencodec:"required"`
|
||
|
Random common.Hash `json:"random" gencodec:"required"`
|
||
|
SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient" gencodec:"required"`
|
||
4 years ago
|
}
|
||
3 years ago
|
var enc PayloadAttributesV1
|
||
|
enc.Timestamp = hexutil.Uint64(p.Timestamp)
|
||
|
enc.Random = p.Random
|
||
3 years ago
|
enc.SuggestedFeeRecipient = p.SuggestedFeeRecipient
|
||
4 years ago
|
return json.Marshal(&enc)
|
||
|
}
|
||
|
|
||
|
// UnmarshalJSON unmarshals from JSON.
|
||
3 years ago
|
func (p *PayloadAttributesV1) UnmarshalJSON(input []byte) error {
|
||
|
type PayloadAttributesV1 struct {
|
||
3 years ago
|
Timestamp *hexutil.Uint64 `json:"timestamp" gencodec:"required"`
|
||
|
Random *common.Hash `json:"random" gencodec:"required"`
|
||
|
SuggestedFeeRecipient *common.Address `json:"suggestedFeeRecipient" gencodec:"required"`
|
||
4 years ago
|
}
|
||
3 years ago
|
var dec PayloadAttributesV1
|
||
4 years ago
|
if err := json.Unmarshal(input, &dec); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
if dec.Timestamp == nil {
|
||
3 years ago
|
return errors.New("missing required field 'timestamp' for PayloadAttributesV1")
|
||
4 years ago
|
}
|
||
3 years ago
|
p.Timestamp = uint64(*dec.Timestamp)
|
||
3 years ago
|
if dec.Random == nil {
|
||
3 years ago
|
return errors.New("missing required field 'random' for PayloadAttributesV1")
|
||
3 years ago
|
}
|
||
3 years ago
|
p.Random = *dec.Random
|
||
3 years ago
|
if dec.SuggestedFeeRecipient == nil {
|
||
|
return errors.New("missing required field 'suggestedFeeRecipient' for PayloadAttributesV1")
|
||
3 years ago
|
}
|
||
3 years ago
|
p.SuggestedFeeRecipient = *dec.SuggestedFeeRecipient
|
||
4 years ago
|
return nil
|
||
|
}
|