2017-06-13 12:49:07 +03:00
|
|
|
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
|
|
|
|
|
|
|
package whisperv5
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
|
|
)
|
|
|
|
|
2017-08-08 14:48:06 +03:00
|
|
|
var _ = (*messageOverride)(nil)
|
|
|
|
|
2017-06-13 12:49:07 +03:00
|
|
|
func (m Message) MarshalJSON() ([]byte, error) {
|
|
|
|
type Message struct {
|
|
|
|
Sig hexutil.Bytes `json:"sig,omitempty"`
|
|
|
|
TTL uint32 `json:"ttl"`
|
|
|
|
Timestamp uint32 `json:"timestamp"`
|
|
|
|
Topic TopicType `json:"topic"`
|
|
|
|
Payload hexutil.Bytes `json:"payload"`
|
|
|
|
Padding hexutil.Bytes `json:"padding"`
|
|
|
|
PoW float64 `json:"pow"`
|
|
|
|
Hash hexutil.Bytes `json:"hash"`
|
|
|
|
Dst hexutil.Bytes `json:"recipientPublicKey,omitempty"`
|
|
|
|
}
|
|
|
|
var enc Message
|
|
|
|
enc.Sig = m.Sig
|
|
|
|
enc.TTL = m.TTL
|
|
|
|
enc.Timestamp = m.Timestamp
|
|
|
|
enc.Topic = m.Topic
|
|
|
|
enc.Payload = m.Payload
|
|
|
|
enc.Padding = m.Padding
|
|
|
|
enc.PoW = m.PoW
|
|
|
|
enc.Hash = m.Hash
|
|
|
|
enc.Dst = m.Dst
|
|
|
|
return json.Marshal(&enc)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Message) UnmarshalJSON(input []byte) error {
|
|
|
|
type Message struct {
|
2018-01-08 16:13:22 +03:00
|
|
|
Sig *hexutil.Bytes `json:"sig,omitempty"`
|
|
|
|
TTL *uint32 `json:"ttl"`
|
|
|
|
Timestamp *uint32 `json:"timestamp"`
|
|
|
|
Topic *TopicType `json:"topic"`
|
|
|
|
Payload *hexutil.Bytes `json:"payload"`
|
|
|
|
Padding *hexutil.Bytes `json:"padding"`
|
|
|
|
PoW *float64 `json:"pow"`
|
|
|
|
Hash *hexutil.Bytes `json:"hash"`
|
|
|
|
Dst *hexutil.Bytes `json:"recipientPublicKey,omitempty"`
|
2017-06-13 12:49:07 +03:00
|
|
|
}
|
|
|
|
var dec Message
|
|
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if dec.Sig != nil {
|
2018-01-08 16:13:22 +03:00
|
|
|
m.Sig = *dec.Sig
|
2017-06-13 12:49:07 +03:00
|
|
|
}
|
|
|
|
if dec.TTL != nil {
|
|
|
|
m.TTL = *dec.TTL
|
|
|
|
}
|
|
|
|
if dec.Timestamp != nil {
|
|
|
|
m.Timestamp = *dec.Timestamp
|
|
|
|
}
|
|
|
|
if dec.Topic != nil {
|
|
|
|
m.Topic = *dec.Topic
|
|
|
|
}
|
|
|
|
if dec.Payload != nil {
|
2018-01-08 16:13:22 +03:00
|
|
|
m.Payload = *dec.Payload
|
2017-06-13 12:49:07 +03:00
|
|
|
}
|
|
|
|
if dec.Padding != nil {
|
2018-01-08 16:13:22 +03:00
|
|
|
m.Padding = *dec.Padding
|
2017-06-13 12:49:07 +03:00
|
|
|
}
|
|
|
|
if dec.PoW != nil {
|
|
|
|
m.PoW = *dec.PoW
|
|
|
|
}
|
|
|
|
if dec.Hash != nil {
|
2018-01-08 16:13:22 +03:00
|
|
|
m.Hash = *dec.Hash
|
2017-06-13 12:49:07 +03:00
|
|
|
}
|
|
|
|
if dec.Dst != nil {
|
2018-01-08 16:13:22 +03:00
|
|
|
m.Dst = *dec.Dst
|
2017-06-13 12:49:07 +03:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|