github.com/theQRL/go-zond@v0.2.1/beacon/engine/gen_epe.go (about) 1 // Code generated by github.com/fjl/gencodec. DO NOT EDIT. 2 3 package engine 4 5 import ( 6 "encoding/json" 7 "errors" 8 "math/big" 9 10 "github.com/theQRL/go-zond/common/hexutil" 11 ) 12 13 var _ = (*executionPayloadEnvelopeMarshaling)(nil) 14 15 // MarshalJSON marshals as JSON. 16 func (e ExecutionPayloadEnvelope) MarshalJSON() ([]byte, error) { 17 type ExecutionPayloadEnvelope struct { 18 ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"` 19 BlockValue *hexutil.Big `json:"blockValue" gencodec:"required"` 20 Override bool `json:"shouldOverrideBuilder"` 21 } 22 var enc ExecutionPayloadEnvelope 23 enc.ExecutionPayload = e.ExecutionPayload 24 enc.BlockValue = (*hexutil.Big)(e.BlockValue) 25 enc.Override = e.Override 26 return json.Marshal(&enc) 27 } 28 29 // UnmarshalJSON unmarshals from JSON. 30 func (e *ExecutionPayloadEnvelope) UnmarshalJSON(input []byte) error { 31 type ExecutionPayloadEnvelope struct { 32 ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"` 33 BlockValue *hexutil.Big `json:"blockValue" gencodec:"required"` 34 Override *bool `json:"shouldOverrideBuilder"` 35 } 36 var dec ExecutionPayloadEnvelope 37 if err := json.Unmarshal(input, &dec); err != nil { 38 return err 39 } 40 if dec.ExecutionPayload == nil { 41 return errors.New("missing required field 'executionPayload' for ExecutionPayloadEnvelope") 42 } 43 e.ExecutionPayload = dec.ExecutionPayload 44 if dec.BlockValue == nil { 45 return errors.New("missing required field 'blockValue' for ExecutionPayloadEnvelope") 46 } 47 e.BlockValue = (*big.Int)(dec.BlockValue) 48 if dec.Override != nil { 49 e.Override = *dec.Override 50 } 51 return nil 52 }