mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 05:17:22 +00:00
eef2122a9e
* define proto types for engine api * proto lint * prettify * build bazel * generated pb * txs field * regen * ssz gen marshal * fastssz * ssz * fmt * json marshal unmarshal custom * exec json tests * passing tests * deepsource * gaz * gaz * deps * ssz max * regen proto * regen ssz
48 lines
1.4 KiB
Go
48 lines
1.4 KiB
Go
package enginev1
|
|
|
|
import "google.golang.org/protobuf/encoding/protojson"
|
|
|
|
// MarshalJSON defines a custom json.Marshaler interface implementation
|
|
// that uses protojson underneath the hood, as protojson will respect
|
|
// proper struct tag naming conventions required for the JSON-RPC engine API to work.
|
|
func (e *ExecutionPayload) MarshalJSON() ([]byte, error) {
|
|
return protojson.Marshal(e)
|
|
}
|
|
|
|
// UnmarshalJSON defines a custom json.Unmarshaler interface implementation
|
|
// that uses protojson underneath the hood, as protojson will respect
|
|
// proper struct tag naming conventions required for the JSON-RPC engine API to work.
|
|
func (e *ExecutionPayload) UnmarshalJSON(enc []byte) error {
|
|
return protojson.Unmarshal(enc, e)
|
|
}
|
|
|
|
// MarshalJSON --
|
|
func (p *PayloadAttributes) MarshalJSON() ([]byte, error) {
|
|
return protojson.Marshal(p)
|
|
}
|
|
|
|
// UnmarshalJSON --
|
|
func (p *PayloadAttributes) UnmarshalJSON(enc []byte) error {
|
|
return protojson.Unmarshal(enc, p)
|
|
}
|
|
|
|
// MarshalJSON --
|
|
func (p *PayloadStatus) MarshalJSON() ([]byte, error) {
|
|
return protojson.Marshal(p)
|
|
}
|
|
|
|
// UnmarshalJSON --
|
|
func (p *PayloadStatus) UnmarshalJSON(enc []byte) error {
|
|
return protojson.Unmarshal(enc, p)
|
|
}
|
|
|
|
// MarshalJSON --
|
|
func (f *ForkchoiceState) MarshalJSON() ([]byte, error) {
|
|
return protojson.Marshal(f)
|
|
}
|
|
|
|
// UnmarshalJSON --
|
|
func (f *ForkchoiceState) UnmarshalJSON(enc []byte) error {
|
|
return protojson.Unmarshal(enc, f)
|
|
}
|