public static Block convertEtherBlockToKunderaBlock ( EthBlock block , boolean includeTransactions ) { Block kunderaBlk = new Block ( ) ; org . web3j . protocol . core . methods . response . EthBlock . Block blk = block . getBlock ( ) ; kunderaBlk . setAuthor ( blk . getAuthor ( ) ) ; kunderaBlk . setDifficulty ( blk . getDifficultyRaw ( ) ) ; kunderaBlk . setExtraData ( blk . getExtraData ( ) ) ; kunderaBlk . setGasLimit ( blk . getGasLimitRaw ( ) ) ; kunderaBlk . setGasUsed ( blk . getGasUsedRaw ( ) ) ; kunderaBlk . setHash ( blk . getHash ( ) ) ; kunderaBlk . setLogsBloom ( blk . getLogsBloom ( ) ) ; kunderaBlk . setMiner ( blk . getMiner ( ) ) ; kunderaBlk . setMixHash ( blk . getMixHash ( ) ) ; kunderaBlk . setNonce ( blk . getNonceRaw ( ) ) ; kunderaBlk . setNumber ( blk . getNumberRaw ( ) ) ; kunderaBlk . setParentHash ( blk . getParentHash ( ) ) ; kunderaBlk . setReceiptsRoot ( blk . getReceiptsRoot ( ) ) ; kunderaBlk . setSealFields ( blk . getSealFields ( ) ) ; kunderaBlk . setSha3Uncles ( blk . getSha3Uncles ( ) ) ; kunderaBlk . setSize ( blk . getSizeRaw ( ) ) ; kunderaBlk . setStateRoot ( blk . getStateRoot ( ) ) ; kunderaBlk . setTimestamp ( blk . getTimestampRaw ( ) ) ; kunderaBlk . setTotalDifficulty ( blk . getTotalDifficultyRaw ( ) ) ; kunderaBlk . setTransactionsRoot ( blk . getTransactionsRoot ( ) ) ; kunderaBlk . setUncles ( blk . getUncles ( ) ) ; if ( includeTransactions ) { List < Transaction > kunderaTxs = new ArrayList <> ( ) ; List < TransactionResult > txResults = block . getBlock ( ) . getTransactions ( ) ; if ( txResults != null && ! txResults . isEmpty ( ) ) { for ( TransactionResult transactionResult : txResults ) { kunderaTxs . add ( convertEtherTxToKunderaTx ( transactionResult ) ) ; } kunderaBlk . setTransactions ( kunderaTxs ) ; } } return kunderaBlk ; }
Convert ether block to kundera block .