github.com/theQRL/go-zond@v0.1.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 BlobsBundle *BlobsBundleV1 `json:"blobsBundle"` 21 Override bool `json:"shouldOverrideBuilder"` 22 } 23 var enc ExecutionPayloadEnvelope 24 enc.ExecutionPayload = e.ExecutionPayload 25 enc.BlockValue = (*hexutil.Big)(e.BlockValue) 26 enc.BlobsBundle = e.BlobsBundle 27 enc.Override = e.Override 28 return json.Marshal(&enc) 29 } 30 31 // UnmarshalJSON unmarshals from JSON. 32 func (e *ExecutionPayloadEnvelope) UnmarshalJSON(input []byte) error { 33 type ExecutionPayloadEnvelope struct { 34 ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"` 35 BlockValue *hexutil.Big `json:"blockValue" gencodec:"required"` 36 BlobsBundle *BlobsBundleV1 `json:"blobsBundle"` 37 Override *bool `json:"shouldOverrideBuilder"` 38 } 39 var dec ExecutionPayloadEnvelope 40 if err := json.Unmarshal(input, &dec); err != nil { 41 return err 42 } 43 if dec.ExecutionPayload == nil { 44 return errors.New("missing required field 'executionPayload' for ExecutionPayloadEnvelope") 45 } 46 e.ExecutionPayload = dec.ExecutionPayload 47 if dec.BlockValue == nil { 48 return errors.New("missing required field 'blockValue' for ExecutionPayloadEnvelope") 49 } 50 e.BlockValue = (*big.Int)(dec.BlockValue) 51 if dec.BlobsBundle != nil { 52 e.BlobsBundle = dec.BlobsBundle 53 } 54 if dec.Override != nil { 55 e.Override = *dec.Override 56 } 57 return nil 58 }