new Network()
Methods
-
<async> addBlockListener(listenerName, callback [, options])
-
Create a block event listener
Parameters:
Name Type Argument Description listenerNameString a unique name identifying the listener callbackfunction the callback called when an event is triggered with signature (error, block) optionsmodule:fabric-network.Network~EventListenerOptions <optional>
Optional. The event listener options Returns:
- Type
- module:fabric-network~BlockEventListener
-
<async> addCommitListener(transactionId, callback [, options] [, eventHub])
-
Create a commit event listener for this transaction.
Parameters:
Name Type Argument Description transactionIdstring The transactionId being watched callbackfunction This callback will be triggered when a transaction commit event is emitted. It takes parameters of error, transactionId, transaction status and block number optionsmodule:fabric-network.Network~EventListenerOptions <optional>
Optional. The event listener options registrations allowing start and end block numbers. eventHubChannelEventHub <optional>
Optional. Used to override the event hub selection Returns:
- Type
- module:fabric-network~CommitEventListener
-
getChannel()
-
Get the underlying channel object representation of this network.
Returns:
A channel.- Type
- Channel
-
getContract(chaincodeId [, name])
-
Get an instance of a contract (chaincode) on the current network.
Parameters:
Name Type Argument Description chaincodeIdstring the chaincode identifier. namestring <optional>
name of the contract. Returns:
the contract.
Type Definitions
-
CheckpointerFactory(channelName, listenerName [, options])
-
Parameters:
Name Type Argument Description channelNameString the name of the channel the checkpoint exists in listenerNameString the name of the listener being checkpointed optionsObject <optional>
Optional. Options to configure behaviour of custom checkpointers i.e. Supplying database connection details Returns:
- Type
- BaseCheckpointer
-
EventListenerOptions
-
Type:
- Object
Properties:
Name Type Argument Default Description checkpointerObject The checkpointer factory and options Properties
Name Type Argument Description factorymodule:fabric-network.Network~CheckpointerFactory The checkpointer factory optionsObject <optional>
The checkpoint configuration options replayboolean <optional>
false event replay and checkpointing on listener filteredboolean <optional>
false use receive filtered block events or not unregisterboolean <optional>
false unregisters the listener as soon as a single event is received startBlocknumber <optional>
the first block to play events from endBlocknumber <optional>
the final block to play events from asArrayboolean <optional>
will deliver all of the events in a block to the callback eventHubConnectWaitnumber <optional>
1000 the number of milliseconds before looking for a new event hub eventHubConnectTimeoutnumber <optional>
30000 the number of milliseconds before timing out event hub connect