aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv5/gen_newmessage_json.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-06-26 18:44:35 +0800
committerGitHub <noreply@github.com>2017-06-26 18:44:35 +0800
commitfeb29327066d6076d1802cdc1492d43a39cec276 (patch)
tree93f3231648b0f225c0c8d44bf81304282f93b605 /whisper/whisperv5/gen_newmessage_json.go
parentf321ed23fbaad8a13cc672f601b15f5272b4b2bb (diff)
parentea1d1825a8509b3353c535c9444861e15471942a (diff)
downloadgo-tangerine-feb29327066d6076d1802cdc1492d43a39cec276.tar
go-tangerine-feb29327066d6076d1802cdc1492d43a39cec276.tar.gz
go-tangerine-feb29327066d6076d1802cdc1492d43a39cec276.tar.bz2
go-tangerine-feb29327066d6076d1802cdc1492d43a39cec276.tar.lz
go-tangerine-feb29327066d6076d1802cdc1492d43a39cec276.tar.xz
go-tangerine-feb29327066d6076d1802cdc1492d43a39cec276.tar.zst
go-tangerine-feb29327066d6076d1802cdc1492d43a39cec276.zip
Merge pull request #14540 from bas-vk/whisper-api
whisperv5: integrate whisper and implement API
Diffstat (limited to 'whisper/whisperv5/gen_newmessage_json.go')
-rw-r--r--whisper/whisperv5/gen_newmessage_json.go86
1 files changed, 86 insertions, 0 deletions
diff --git a/whisper/whisperv5/gen_newmessage_json.go b/whisper/whisperv5/gen_newmessage_json.go
new file mode 100644
index 000000000..0231cd919
--- /dev/null
+++ b/whisper/whisperv5/gen_newmessage_json.go
@@ -0,0 +1,86 @@
+// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
+
+package whisperv5
+
+import (
+ "encoding/json"
+
+ "github.com/ethereum/go-ethereum/common/hexutil"
+)
+
+func (n NewMessage) MarshalJSON() ([]byte, error) {
+ type NewMessage struct {
+ SymKeyID string `json:"symKeyID"`
+ PublicKey hexutil.Bytes `json:"pubKey"`
+ Sig string `json:"sig"`
+ TTL uint32 `json:"ttl"`
+ Topic TopicType `json:"topic"`
+ Payload hexutil.Bytes `json:"payload"`
+ Padding hexutil.Bytes `json:"padding"`
+ PowTime uint32 `json:"powTime"`
+ PowTarget float64 `json:"powTarget"`
+ TargetPeer string `json:"targetPeer"`
+ }
+ var enc NewMessage
+ enc.SymKeyID = n.SymKeyID
+ enc.PublicKey = n.PublicKey
+ enc.Sig = n.Sig
+ enc.TTL = n.TTL
+ enc.Topic = n.Topic
+ enc.Payload = n.Payload
+ enc.Padding = n.Padding
+ enc.PowTime = n.PowTime
+ enc.PowTarget = n.PowTarget
+ enc.TargetPeer = n.TargetPeer
+ return json.Marshal(&enc)
+}
+
+func (n *NewMessage) UnmarshalJSON(input []byte) error {
+ type NewMessage struct {
+ SymKeyID *string `json:"symKeyID"`
+ PublicKey hexutil.Bytes `json:"pubKey"`
+ Sig *string `json:"sig"`
+ TTL *uint32 `json:"ttl"`
+ Topic *TopicType `json:"topic"`
+ Payload hexutil.Bytes `json:"payload"`
+ Padding hexutil.Bytes `json:"padding"`
+ PowTime *uint32 `json:"powTime"`
+ PowTarget *float64 `json:"powTarget"`
+ TargetPeer *string `json:"targetPeer"`
+ }
+ var dec NewMessage
+ if err := json.Unmarshal(input, &dec); err != nil {
+ return err
+ }
+ if dec.SymKeyID != nil {
+ n.SymKeyID = *dec.SymKeyID
+ }
+ if dec.PublicKey != nil {
+ n.PublicKey = dec.PublicKey
+ }
+ if dec.Sig != nil {
+ n.Sig = *dec.Sig
+ }
+ if dec.TTL != nil {
+ n.TTL = *dec.TTL
+ }
+ if dec.Topic != nil {
+ n.Topic = *dec.Topic
+ }
+ if dec.Payload != nil {
+ n.Payload = dec.Payload
+ }
+ if dec.Padding != nil {
+ n.Padding = dec.Padding
+ }
+ if dec.PowTime != nil {
+ n.PowTime = *dec.PowTime
+ }
+ if dec.PowTarget != nil {
+ n.PowTarget = *dec.PowTarget
+ }
+ if dec.TargetPeer != nil {
+ n.TargetPeer = *dec.TargetPeer
+ }
+ return nil
+}