public class ChainFunctions
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ChainFunctions.HeaderAndValidators |
Constructor and Description |
---|
ChainFunctions() |
Modifier and Type | Method and Description |
---|---|
static Types.DeriveRealFunction |
bestNumber(Types.ApiInterfacePromise api)
Get the latest block number.
|
static Types.DeriveRealFunction |
bestNumberFinalized(Types.ApiInterfacePromise api)
Get the latest finalised block number.
|
static Types.DeriveRealFunction |
bestNumberLag(Types.ApiInterfacePromise api)
Calculates the lag between finalised head and best head example
|
static Types.DeriveRealFunction |
getHeader(Types.ApiInterfacePromise api)
Get the a specific block header and extend it with the author
|
static Types.DeriveRealFunction |
subscribeNewHead(Types.ApiInterfacePromise api)
Subscribe to block headers and extend it with the author ```
|
public static Types.DeriveRealFunction bestNumber(Types.ApiInterfacePromise api)
Get the latest block number. example
api.derive.chain.bestNumber((blockNumber) => {
System.out.print("the current best block is ");
System.out.println(blockNumber);
});
public static Types.DeriveRealFunction bestNumberFinalized(Types.ApiInterfacePromise api)
Get the latest finalised block number. example
api.derive.chain.bestNumberFinalized((blockNumber) => {
System.out.print("the current finalised block is ");
System.out.print(blockNumber);
});
public static Types.DeriveRealFunction bestNumberLag(Types.ApiInterfacePromise api)
Calculates the lag between finalised head and best head example
api.derive.chain.bestNumberLag((lag) => {
System.out.printf("finalised is %d blocks behind head", lag);
});
public static Types.DeriveRealFunction getHeader(Types.ApiInterfacePromise api)
Get the a specific block header and extend it with the author
public static Types.DeriveRealFunction subscribeNewHead(Types.ApiInterfacePromise api)
Subscribe to block headers and extend it with the author ```