github.com/lmittmann/w3@v0.20.0/module/eth/syncing.go (about) 1 package eth 2 3 import ( 4 "github.com/lmittmann/w3/internal/module" 5 "github.com/lmittmann/w3/w3types" 6 ) 7 8 // Syncing requests the syncing status of the node. 9 func Syncing() w3types.RPCCallerFactory[bool] { 10 return module.NewFactory( 11 "eth_syncing", 12 []any{}, 13 module.WithRetWrapper(syncingRetWrapper), 14 ) 15 } 16 17 func syncingRetWrapper(ret *bool) any { 18 return (*syncingBool)(ret) 19 } 20 21 type syncingBool bool 22 23 func (s *syncingBool) UnmarshalJSON(b []byte) error { 24 if string(b) == "false" { 25 *s = false 26 } else { 27 *s = true 28 } 29 return nil 30 }