Get block and private data events.
GatewayError Thrown by the iterator if the gRPC service invocation fails.
const events = await network.getBlockAndPrivateEventsData({ startBlock: BigInt(101) });
try {
for async (const event of events) {
// Process block and private data event
}
} finally {
events.close();
}
Optional
options: EventsOptionsEvent listening options.
Blocks and private data protocol buffer messages. The iterator should be closed after use to complete the eventing session.
Get block events.
GatewayError Thrown by the iterator if the gRPC service invocation fails.
const blocks = await network.getBlockEvents({ startBlock: BigInt(101) });
try {
for async (const block of blocks) {
// Process block
}
} finally {
blocks.close();
}
Optional
options: EventsOptionsEvent listening options.
Block protocol buffer messages. The iterator should be closed after use to complete the eventing session.
Get chaincode events emitted by transaction functions of a specific chaincode.
GatewayError Thrown by the iterator if the gRPC service invocation fails.
const events = await network.getChaincodeEvents(chaincodeName, { startBlock: BigInt(101) });
try {
for async (const event of events) {
// Process event
}
} finally {
events.close();
}
A chaincode name.
Optional
options: EventsOptionsEvent listening options.
The iterator should be closed after use to complete the eventing session.
Get a smart contract within the named chaincode. If no contract name is supplied, this is the default smart contract for the named chaincode.
Chaincode name.
Optional
contractName: stringSmart contract name.
Get filtered block events.
GatewayError Thrown by the iterator if the gRPC service invocation fails.
const blocks = await network.getFilteredBlockEvents({ startBlock: BigInt(101) });
try {
for async (const block of blocks) {
// Process block
}
} finally {
blocks.close();
}
Optional
options: EventsOptionsEvent listening options.
Filtered block protocol buffer messages. The iterator should be closed after use to complete the eventing session.
Create a request to receive block and private data events. Supports off-line signing flow.
Optional
options: EventsOptionsEvent listening options.
Create a request to receive block events. Supports off-line signing flow.
Optional
options: EventsOptionsEvent listening options.
Create a request to receive chaincode events emitted by transaction functions of a specific chaincode. Supports off-line signing flow.
Chaincode name.
Optional
options: EventsOptionsEvent listening options.
Create a request to receive filtered block events. Supports off-line signing flow.
Optional
options: EventsOptionsEvent listening options.
Generated using TypeDoc
Network represents a network of nodes that are members of a specific Fabric channel. The Network can be used to access deployed smart contracts, and to listen for events emitted when blocks are committed to the ledger. Network instances are obtained from a Gateway using the getNetwork method.
To safely handle connection errors during eventing, it is recommended to use a checkpointer to track eventing progress. This allows eventing to be resumed with no loss or duplication of events.
Example
Chaincode events
Example
Block events