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 15
15
package localstatequery
16
16
17
17
import (
18
+ "encoding/json"
18
19
"fmt"
19
20
"math/big"
20
21
@@ -426,6 +427,33 @@ func (s SystemStartResult) String() string {
426
427
return fmt .Sprintf ("SystemStart %s %d %s" , s .Year .String (), s .Day , s .Picoseconds .String ())
427
428
}
428
429
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
+
429
457
type ChainBlockNoQuery struct {
430
458
simpleQueryBase
431
459
}
You can’t perform that action at this time.
0 commit comments