github.com/lmittmann/w3@v0.20.0/docs/pages/rpc-methods/net.mdx (about)

     1  # `net`-Namespace
     2  
     3  List of supported RPC methods for `w3.Client` in the `net`-namespace.
     4  
     5  ## `net_listening`
     6  `Listening` returns whether the client is actively listening for network connections.
     7  ```go {3}
     8  var listening bool
     9  client.Call(
    10      net.Listening().Returns(&listening),
    11  )
    12  ```
    13  
    14  ## `net_peerCount`
    15  `PeerCount` returns the number of peers connected to the node.
    16  ```go {3}
    17  var peerCount int
    18  client.Call(
    19      net.PeerCount().Returns(&peerCount),
    20  )
    21  ```
    22  
    23  ## `net_version`
    24  `Version` returns the network ID (e.g. 1 for mainnet).
    25  ```go {3}
    26  var version int
    27  client.Call(
    28      net.Version().Returns(&version),
    29  )
    30  ```