@tevm/voltaire / primitives/PeerInfo
primitives/PeerInfo
Type Aliases
PeerInfoType
PeerInfoType = object
Defined in: src/primitives/PeerInfo/PeerInfoType.ts:16
Peer information structure from admin_peers RPC method
Contains metadata about a connected peer including:
- Peer identity (ID, name, capabilities)
- Network connection details (local/remote addresses, direction)
- Protocol-specific state (difficulty, head block)
See
https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-admin#admin-peersProperties
caps
Defined in: src/primitives/PeerInfo/PeerInfoType.ts:22 Supported capabilities (e.g., [“eth/67”, “snap/1”])readonlycaps: readonlystring[]
id
Defined in: src/primitives/PeerInfo/PeerInfoType.ts:18 Peer ID (enode URL)readonlyid:PeerIdType
name
Defined in: src/primitives/PeerInfo/PeerInfoType.ts:20 Remote client identifier (e.g., “Geth/v1.10.26-stable”)readonlyname:string
network
Defined in: src/primitives/PeerInfo/PeerInfoType.ts:24 Network connection informationreadonlynetwork:object
inbound
True if inbound connectionreadonlyinbound:boolean
localAddress
Local endpoint (IP:PORT)readonlylocalAddress:string
remoteAddress
Remote endpoint (IP:PORT)readonlyremoteAddress:string
static
True if static nodereadonlystatic:boolean
trusted
True if trusted peerreadonlytrusted:boolean
protocols
Defined in: src/primitives/PeerInfo/PeerInfoType.ts:37 Protocol-specific informationreadonlyprotocols:object
Index Signature
[protocol: string]: unknown
Other protocols
eth?
Ethereum protocol info (if supported)readonlyoptionaleth:object
eth.difficulty
Total difficulty of peer’s chainreadonlydifficulty:BrandedUint
eth.head
Peer’s head block hashreadonlyhead:BlockHashType
eth.version
Protocol versionreadonlyversion:ProtocolVersionType
Variables
PeerInfo
Defined in: src/primitives/PeerInfo/index.ts:29constPeerInfo:object
Type Declaration
from()
from: (Create PeerInfo from RPC response objectvalue) =>PeerInfoType
Parameters
value
any
Peer info object from admin_peers
Returns
PeerInfoType
Peer information
Throws
If value is not a valid peer info objectExample
hasCapability()
hasCapability: (peerInfo,capability) =>boolean
Parameters
peerInfo
any
capability
string
Returns
boolean
isInbound()
isInbound: (peerInfo) =>boolean
Parameters
peerInfo
any
Returns
boolean
Functions
_hasCapability()
_hasCapability(Defined in: src/primitives/PeerInfo/hasCapability.js:15 Check if peer supports a specific capabilitythis,capability):boolean
Parameters
this
PeerInfoType
capability
string
Capability to check (e.g., “eth/67”, “snap/1”)
Returns
boolean
True if peer supports capability
Example
_isInbound()
_isInbound(Defined in: src/primitives/PeerInfo/isInbound.js:14 Check if peer connection is inboundthis):boolean
Parameters
this
PeerInfoType
Returns
boolean
True if inbound connection
Example
from()
from(Defined in: src/primitives/PeerInfo/from.js:25 Create PeerInfo from RPC response objectvalue):PeerInfoType
Parameters
value
any
Peer info object from admin_peers
Returns
PeerInfoType
Peer information
Throws
If value is not a valid peer info objectExample
hasCapability()
hasCapability(Defined in: src/primitives/PeerInfo/index.ts:14peerInfo,capability):boolean
Parameters
peerInfo
any
capability
string
Returns
boolean
isInbound()
isInbound(Defined in: src/primitives/PeerInfo/index.ts:20peerInfo):boolean
Parameters
peerInfo
any
Returns
boolean
