ethereumjs-client › "net/protocol/lesprotocol" › LesProtocol
Implements les/1 and les/2 protocols
memberof
module:net/protocol
↳ Protocol
↳ LesProtocol
- addListener
- bind
- decode
- decodeStatus
- emit
- encode
- encodeStatus
- eventNames
- getMaxListeners
- handshake
- listenerCount
- listeners
- off
- on
- once
- open
- prependListener
- prependOnceListener
- rawListeners
- removeAllListeners
- removeListener
- setMaxListeners
+ new LesProtocol(options
: LesProtocolOptions): LesProtocol
Overrides Protocol.constructor
Defined in lib/net/protocol/lesprotocol.ts:75
Create les protocol
Parameters:
Name | Type |
---|---|
options |
LesProtocolOptions |
Returns: LesProtocol
• config: Config
Inherited from EthProtocol.config
Defined in lib/net/protocol/protocol.ts:41
• opened: boolean
Inherited from EthProtocol.opened
Defined in lib/net/protocol/protocol.ts:43
• timeout: number
Inherited from EthProtocol.timeout
Defined in lib/net/protocol/protocol.ts:42
• get messages(): any
Defined in lib/net/protocol/lesprotocol.ts:111
Messages defined by this protocol
type
{Protocol~Message[]}
Returns: any
• get name(): string
Defined in lib/net/protocol/lesprotocol.ts:95
Name of protocol
type
{string}
Returns: string
• get versions(): number[]
Defined in lib/net/protocol/lesprotocol.ts:103
Protocol versions supported
type
{number[]}
Returns: number[]
▸ addListener(event
: string | symbol, listener
: function): this
Inherited from Sender.addListener
Defined in node_modules/@types/node/events.d.ts:62
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ bind(peer
: Peer, sender
: Sender): Promise‹BoundProtocol›
Inherited from EthProtocol.bind
Defined in lib/net/protocol/protocol.ts:171
Binds this protocol to a given peer using the specified sender to handle message communication.
Parameters:
Name | Type | Description |
---|---|---|
peer |
Peer | peer |
sender |
Sender | sender |
Returns: Promise‹BoundProtocol›
▸ decode(message
: Message, payload
: any): any
Inherited from EthProtocol.decode
Defined in lib/net/protocol/protocol.ts:157
Decodes message payload
Parameters:
Name | Type | Description |
---|---|---|
message |
Message | message definition |
payload |
any | message payload |
Returns: any
▸ decodeStatus(status
: any): any
Overrides Protocol.decodeStatus
Defined in lib/net/protocol/lesprotocol.ts:164
Decodes ETH status message payload into a status object
Parameters:
Name | Type | Description |
---|---|---|
status |
any | status message payload |
Returns: any
▸ emit(event
: string | symbol, ...args
: any[]): boolean
Defined in node_modules/@types/node/events.d.ts:72
Parameters:
Name | Type |
---|---|
event |
string | symbol |
...args |
any[] |
Returns: boolean
▸ encode(message
: Message, args
: any): any
Inherited from EthProtocol.encode
Defined in lib/net/protocol/protocol.ts:142
Encodes message into proper format before sending
Parameters:
Name | Type | Description |
---|---|---|
message |
Message | message definition |
args |
any | message arguments |
Returns: any
▸ encodeStatus(): any
Overrides Protocol.encodeStatus
Defined in lib/net/protocol/lesprotocol.ts:131
Encodes status into LES status message payload
Returns: any
▸ eventNames(): Array‹string | symbol›
Inherited from Sender.eventNames
Defined in node_modules/@types/node/events.d.ts:77
Returns: Array‹string | symbol›
▸ getMaxListeners(): number
Inherited from Sender.getMaxListeners
Defined in node_modules/@types/node/events.d.ts:69
Returns: number
▸ handshake(sender
: Sender): Promise‹unknown›
Inherited from EthProtocol.handshake
Defined in lib/net/protocol/protocol.ts:71
Perform handshake given a sender from subclass.
Parameters:
Name | Type |
---|---|
sender |
Sender |
Returns: Promise‹unknown›
▸ listenerCount(event
: string | symbol): number
Inherited from Sender.listenerCount
Defined in node_modules/@types/node/events.d.ts:73
Parameters:
Name | Type |
---|---|
event |
string | symbol |
Returns: number
▸ listeners(event
: string | symbol): Function[]
Inherited from Sender.listeners
Defined in node_modules/@types/node/events.d.ts:70
Parameters:
Name | Type |
---|---|
event |
string | symbol |
Returns: Function[]
▸ off(event
: string | symbol, listener
: function): this
Defined in node_modules/@types/node/events.d.ts:66
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ on(event
: string | symbol, listener
: function): this
Defined in node_modules/@types/node/events.d.ts:63
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ once(event
: string | symbol, listener
: function): this
Defined in node_modules/@types/node/events.d.ts:64
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ open(): Promise‹boolean | void›
Defined in lib/net/protocol/lesprotocol.ts:119
Opens protocol and any associated dependencies
Returns: Promise‹boolean | void›
▸ prependListener(event
: string | symbol, listener
: function): this
Inherited from Sender.prependListener
Defined in node_modules/@types/node/events.d.ts:75
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ prependOnceListener(event
: string | symbol, listener
: function): this
Inherited from Sender.prependOnceListener
Defined in node_modules/@types/node/events.d.ts:76
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ rawListeners(event
: string | symbol): Function[]
Inherited from Sender.rawListeners
Defined in node_modules/@types/node/events.d.ts:71
Parameters:
Name | Type |
---|---|
event |
string | symbol |
Returns: Function[]
▸ removeAllListeners(event?
: string | symbol): this
Inherited from Sender.removeAllListeners
Defined in node_modules/@types/node/events.d.ts:67
Parameters:
Name | Type |
---|---|
event? |
string | symbol |
Returns: this
▸ removeListener(event
: string | symbol, listener
: function): this
Inherited from Sender.removeListener
Defined in node_modules/@types/node/events.d.ts:65
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ setMaxListeners(n
: number): this
Inherited from Sender.setMaxListeners
Defined in node_modules/@types/node/events.d.ts:68
Parameters:
Name | Type |
---|---|
n |
number |
Returns: this