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