File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1515package localstatequery
1616
1717import (
18+ "encoding/json"
1819 "fmt"
1920 "math/big"
2021
@@ -426,6 +427,33 @@ func (s SystemStartResult) String() string {
426427 return fmt .Sprintf ("SystemStart %s %d %s" , s .Year .String (), s .Day , s .Picoseconds .String ())
427428}
428429
430+ func (s SystemStartResult ) MarshalJSON () ([]byte , error ) {
431+ return json .Marshal (struct {
432+ Year string
433+ Day int
434+ Picoseconds string
435+ }{
436+ Year : s .Year .String (),
437+ Day : s .Day ,
438+ Picoseconds : s .Picoseconds .String (),
439+ })
440+ }
441+
442+ func (s * SystemStartResult ) UnmarshalJSON (data []byte ) error {
443+ var tmp struct {
444+ Year string
445+ Day int
446+ Picoseconds string
447+ }
448+ if err := json .Unmarshal (data , & tmp ); err != nil {
449+ return err
450+ }
451+ s .Year .SetString (tmp .Year , 10 )
452+ s .Day = tmp .Day
453+ s .Picoseconds .SetString (tmp .Picoseconds , 10 )
454+ return nil
455+ }
456+
429457type ChainBlockNoQuery struct {
430458 simpleQueryBase
431459}
You can’t perform that action at this time.
0 commit comments